<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: csm</title>
    <description>The latest articles on DEV Community by csm (@csm18).</description>
    <link>https://dev.to/csm18</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1590922%2F1d71d879-5f9e-42d7-a40e-436badadd278.png</url>
      <title>DEV Community: csm</title>
      <link>https://dev.to/csm18</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/csm18"/>
    <language>en</language>
    <item>
      <title>A picture is worth a thousand words</title>
      <dc:creator>csm</dc:creator>
      <pubDate>Thu, 26 Nov 2026 02:24:31 +0000</pubDate>
      <link>https://dev.to/thethirdcup/a-picture-is-worth-a-thousand-words-40eo</link>
      <guid>https://dev.to/thethirdcup/a-picture-is-worth-a-thousand-words-40eo</guid>
      <description>&lt;p&gt;It was a Friday morning, like every day opened my PC, checked my emails and remembered the day before I made my GitHub org and needed finishing the profile stuff.&lt;/p&gt;

&lt;p&gt;If it was before AI era, I would have searched for a good free image for the org profile, but new times so new ways (but laziness stays the same 😉), I opened chatgpt and gave it a simple prompt:&lt;br&gt;
&lt;strong&gt;create an anime style boy programmer coding in his cool room&lt;/strong&gt;&lt;br&gt;
Yep, I wanted to put something like that on my GitHub org profile 😄&lt;/p&gt;

&lt;p&gt;Now, it generated a cool image, an anime boy sitting at his desk and coding on a PC, even the code is visible (I will get to this part soon!) some books there on the table, night dark blue theme, head set, and a poster on the wall saying &lt;strong&gt;"Just keep coding!"&lt;/strong&gt;&lt;br&gt;
Sounds cool right?&lt;br&gt;
I literally gave it a thumbs up for it! Pushed it up and it was live!&lt;/p&gt;

&lt;p&gt;After that I went for other stuff and PC off!!&lt;/p&gt;

&lt;h2&gt;
  
  
  So, whats the matter?
&lt;/h2&gt;

&lt;p&gt;Roughly after a day, I wanted to have a closer look at the image.&lt;br&gt;
Guess what?&lt;br&gt;&lt;br&gt;
The image spoke thousand words with extra info from my previous chats 😂&lt;/p&gt;

&lt;p&gt;Here is the image:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnih486l5od0jbd5l2lky.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnih486l5od0jbd5l2lky.png" alt=" " width="800" height="731"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you have a closer look at the image, you will see the names of the books on the table are the topics I prompted in the past few days. I was working on a CPP project that needed xmake setup, so you can see the xmake on the right side of the screen.&lt;br&gt;
And the final highlight is the code on the left of the screen, it has the name of my project and some boilerplate code.&lt;br&gt;
I was like &lt;strong&gt;what?&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;If, I asked for the image in a previous chat where this info was available then Its my fault. But, its a fresh chat and it put my project name in the image and it was there live for a whole day! &lt;/p&gt;

&lt;p&gt;Well, &lt;strong&gt;its not any sensitive info this time, but what if it was?&lt;br&gt;
It taught me a lesson!&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Always check the output before pushing up!
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;First, turn off the memory and then prompt in a fresh chat&lt;/li&gt;
&lt;li&gt;Check the output with magnifying glass &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;A funny incident, but an eye-opener.&lt;/strong&gt;&lt;/p&gt;




&lt;p&gt;This is my first post under The Third Cup.&lt;br&gt;
Thank you so much &lt;a class="mentioned-user" href="https://dev.to/xulingfeng"&gt;@xulingfeng&lt;/a&gt; for keeping the cafe open for stories like these!&lt;/p&gt;

</description>
      <category>ai</category>
      <category>safety</category>
    </item>
    <item>
      <title>String Type In C</title>
      <dc:creator>csm</dc:creator>
      <pubDate>Tue, 24 Nov 2026 12:02:45 +0000</pubDate>
      <link>https://dev.to/necoz/string-type-in-c-3aep</link>
      <guid>https://dev.to/necoz/string-type-in-c-3aep</guid>
      <description>&lt;p&gt;If we go and search for "string type in C" on internet or ask AI, we get a line saying "C has no string type".&lt;br&gt;
I know, we get results like:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqg195ck3mpn7gv271bgm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqg195ck3mpn7gv271bgm.png" alt=" " width="742" height="234"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Most of the tutorials tell how to use a char array for strings but no one tells us how to build a string type using structs and heap allocation.&lt;/p&gt;

&lt;p&gt;So here is simple string type:&lt;/p&gt;

&lt;h2&gt;
  
  
  First, the code!
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="cp"&gt;#include &amp;lt;stdio.h&amp;gt;&lt;/span&gt;
&lt;span class="cp"&gt;#include &amp;lt;stdlib.h&amp;gt;&lt;/span&gt;
&lt;span class="cp"&gt;#include &amp;lt;string.h&amp;gt;&lt;/span&gt;

&lt;span class="k"&gt;typedef&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;char&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kt"&gt;size_t&lt;/span&gt; &lt;span class="n"&gt;len&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kt"&gt;size_t&lt;/span&gt; &lt;span class="n"&gt;cap&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;panic&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;char&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nb"&gt;puts&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nf"&gt;exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;string&lt;/span&gt; &lt;span class="nf"&gt;string_new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;char&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nf"&gt;panic&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"error: NULL passed to string_new()"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="n"&gt;string&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;len&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;strlen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cap&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;sizeof&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;char&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;len&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;malloc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cap&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nf"&gt;panic&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"error: Memory allocation failed!"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="nf"&gt;strcpy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;string_free&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;len&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;cap&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nb"&gt;free&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;string&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;string_new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"King Nyaomaru"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;


    &lt;span class="nb"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Welcome %s!\n"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="nf"&gt;string_free&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Explanation
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;First, the main function is the main function from where the program starts.&lt;/li&gt;
&lt;li&gt;This program does these things:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- Create a string, that is, instance of the struct type string, that we have at the top of the program.
- Format and print the welcome message using our string name. Yep, I followed the Necoz tradition!
- Then free the string's memory using its free function.
- Return 0, that is success!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  string struct
&lt;/h3&gt;

&lt;p&gt;Its a simple struct that has three things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;s (char* pointer that will hold the address to a heap memory location where we put the data (characters)&lt;/li&gt;
&lt;li&gt;len (It will store how many characters the s field has currently&lt;/li&gt;
&lt;li&gt;cap (The total amount of memory, in bytes, allocated that &lt;code&gt;s&lt;/code&gt; points to)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I will leave the string creation and freeing details to the next posts!&lt;/p&gt;

&lt;p&gt;This is a basic version. We can extend the string functions to append or prepend or resize and all kinds of stuff are possible!&lt;/p&gt;

&lt;h2&gt;
  
  
  Acknowledgement
&lt;/h2&gt;

&lt;p&gt;This is my first post under Necoz.&lt;br&gt;
I want to thank &lt;a class="mentioned-user" href="https://dev.to/nyaomaru"&gt;@nyaomaru&lt;/a&gt; and &lt;a class="mentioned-user" href="https://dev.to/star123"&gt;@star123&lt;/a&gt; for making me part of this wonderful org!&lt;/p&gt;

</description>
      <category>c</category>
      <category>beginners</category>
      <category>necoz</category>
    </item>
    <item>
      <title>Memory aur Data-Types</title>
      <dc:creator>csm</dc:creator>
      <pubDate>Tue, 17 Nov 2026 11:53:34 +0000</pubDate>
      <link>https://dev.to/csm18/memory-aur-data-types-21l9</link>
      <guid>https://dev.to/csm18/memory-aur-data-types-21l9</guid>
      <description>&lt;p&gt;Kisi bhi program me hume data ki zarurat padti hai.&lt;/p&gt;

&lt;p&gt;Jese ki:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Calculator program me user ka expression.&lt;/li&gt;
&lt;li&gt;Game me user ka state aur action store karna.&lt;/li&gt;
&lt;li&gt;Website me user ka submit kiya hua form data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Aadi!&lt;/p&gt;

&lt;h2&gt;
  
  
  Memory kya hai?
&lt;/h2&gt;

&lt;p&gt;Hamare computer me 2 jagah par data ko rakhte hain:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Memory (RAM)&lt;/li&gt;
&lt;li&gt;Storage (Hard-Disk)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Memory
&lt;/h3&gt;

&lt;p&gt;Ye RAM ke andar ki jagah hai, jise computer ek program ko run karne aur us program ke data ko rakhne ke liye istemal karta hai.&lt;/p&gt;

&lt;p&gt;Jab hum computer ko off karte hain, to RAM ke andar ki ye jagah saaf ho jaati hai.&lt;/p&gt;

&lt;h3&gt;
  
  
  Storage
&lt;/h3&gt;

&lt;p&gt;Hard disk ya koi bhi aur storage device data ko hamesha ke liye sambhal kar rakhne ke liye use karte hain.&lt;/p&gt;

&lt;p&gt;Isme program ko chalane ke baad uska output ya data store karte hain. Jaise, humne koi file edit ki aur save ki, to computer use RAM se copy karke storage me store karta hai.&lt;/p&gt;

&lt;p&gt;Computer band hone ke baad bhi ye data rahega.&lt;/p&gt;

&lt;h2&gt;
  
  
  Data Types kya hain aur kyu hain?
&lt;/h2&gt;

&lt;p&gt;Maan lo aapke kitchen me ek transparent bottle rakhi hui hai, jisme orange color ka liquid hai.&lt;/p&gt;

&lt;p&gt;Bina jaane ki woh liquid kya hai, kya aap use juice samajh kar piyenge?&lt;/p&gt;

&lt;p&gt;Woh floor cleaner ka liquid bhi ho sakta hai, hai na?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3q954p1ap3i89iw0fd6c.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3q954p1ap3i89iw0fd6c.jpeg" alt=" " width="547" height="365"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Koi bhi pehle yahi sochega ki bottle me kya hai.&lt;/p&gt;

&lt;p&gt;Ye confusion na ho, isliye juice ki apni ek bottle hoti hai, label ke saath, aur uski ek alag jagah hoti hai fridge me.&lt;/p&gt;

&lt;p&gt;Aur floor cleaner ki bhi.&lt;/p&gt;

&lt;p&gt;Liquid ka color same hai aur quantity bhi same hai, isliye agar hum kisi bhi bottle me daalenge, to gadbad hogi.&lt;br&gt;
Usi tarah, computer ko data dene par use pata hona chahiye ki data kitna hai aur kis type ka hai, taaki woh use RAM me sahi tarike se store kar sake aur us par sahi operations kar sake.&lt;/p&gt;

&lt;p&gt;Maan lo humne ek string di, &lt;code&gt;"hello world!"&lt;/code&gt;, aur ek number diya, &lt;code&gt;4&lt;/code&gt;, aur kaha ki dono ko mila do.&lt;/p&gt;

&lt;p&gt;Ab computer bechara kya karega?&lt;/p&gt;

&lt;p&gt;Agar use pata hai ki ye number hai, to woh number ke saath number ko milayega aur string ko string ke saath.&lt;/p&gt;

&lt;p&gt;Warna, bina bataye number aur string ko milane doge, to data corrupt ho sakta hai.&lt;/p&gt;

&lt;p&gt;Isliye har data ka ek type hota hai, aur us type ko hum apne program me pehle hi batate hain ki ye kis type ka data hai. Is par kaun-se operations kar sakte hain aur kaun-se nahi.&lt;/p&gt;

&lt;h2&gt;
  
  
  Go me Data-Types
&lt;/h2&gt;

&lt;h2&gt;
  
  
  1. Basic Types
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Boolean
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;bool&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Boolean value (&lt;code&gt;true&lt;/code&gt; or &lt;code&gt;false&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Integer Types
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;Size&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;int8&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;8-bit&lt;/td&gt;
&lt;td&gt;Signed integer&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;int16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;16-bit&lt;/td&gt;
&lt;td&gt;Signed integer&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;int32&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;32-bit&lt;/td&gt;
&lt;td&gt;Signed integer&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;int64&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;64-bit&lt;/td&gt;
&lt;td&gt;Signed integer&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;int&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;32/64-bit&lt;/td&gt;
&lt;td&gt;Platform-dependent signed integer&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;uint8&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;8-bit&lt;/td&gt;
&lt;td&gt;Unsigned integer&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;uint16&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;16-bit&lt;/td&gt;
&lt;td&gt;Unsigned integer&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;uint32&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;32-bit&lt;/td&gt;
&lt;td&gt;Unsigned integer&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;uint64&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;64-bit&lt;/td&gt;
&lt;td&gt;Unsigned integer&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;uint&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;32/64-bit&lt;/td&gt;
&lt;td&gt;Platform-dependent unsigned integer&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;uintptr&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;32/64-bit&lt;/td&gt;
&lt;td&gt;Integer capable of holding a pointer value&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Floating-Point Types
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;Size&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;float32&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;32-bit&lt;/td&gt;
&lt;td&gt;Single-precision floating point&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;float64&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;64-bit&lt;/td&gt;
&lt;td&gt;Double-precision floating point&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Complex Types
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;Size&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;complex64&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;64-bit&lt;/td&gt;
&lt;td&gt;Complex number&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;complex128&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;128-bit&lt;/td&gt;
&lt;td&gt;Complex number&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Other Basic Types
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;byte&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Alias for &lt;code&gt;uint8&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;rune&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Alias for &lt;code&gt;int32&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;string&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Immutable sequence of bytes&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  2. Composite Types
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Array&lt;/td&gt;
&lt;td&gt;Fixed-length collection of elements&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Slice&lt;/td&gt;
&lt;td&gt;Dynamically sized collection&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Struct&lt;/td&gt;
&lt;td&gt;Collection of fields&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Map&lt;/td&gt;
&lt;td&gt;Key-value data structure&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Pointer&lt;/td&gt;
&lt;td&gt;Stores a memory address&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Function&lt;/td&gt;
&lt;td&gt;Function value&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Channel&lt;/td&gt;
&lt;td&gt;Communication between goroutines&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  3. Interface Types
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;interface&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Defines a set of methods&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;any&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Alias for &lt;code&gt;interface{}&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;error&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Built-in error-handling interface&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  4. Type Constraints (Generics)
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;comparable&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Restricts types to those supporting &lt;code&gt;==&lt;/code&gt; and &lt;code&gt;!=&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;~T&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Matches types with underlying type &lt;code&gt;T&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Ye sab dekh kar darna mat. Ye bas saamanya gyaan ke liye hai. Baaki, hum series me aage ek-ek karke saari zaroori cheezein seekhenge.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Abhi ke liye bas itna hi!&lt;/p&gt;




&lt;p&gt;मैंने भगवान पर एक छोटी-सी शायरी लिखी है।&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fjltibeh0e6iea289ocgl.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fjltibeh0e6iea289ocgl.jpeg" alt=" " width="556" height="289"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>hindi</category>
      <category>tutorial</category>
      <category>go</category>
    </item>
    <item>
      <title>while loop and for loop are not the same in C/C++</title>
      <dc:creator>csm</dc:creator>
      <pubDate>Sun, 15 Nov 2026 05:36:32 +0000</pubDate>
      <link>https://dev.to/csm18/while-loop-and-for-loop-are-not-the-same-in-cc-2l0g</link>
      <guid>https://dev.to/csm18/while-loop-and-for-loop-are-not-the-same-in-cc-2l0g</guid>
      <description>&lt;p&gt;I was writing a small parser logic in C++.&lt;br&gt;
I previously wrote it in another language, so I knew it before hand.&lt;br&gt;
Wrote the code, looking good, confident that it will run correctly.&lt;br&gt;
But, it didn't! It skipped 2 tokens in a branch per iteration.&lt;/p&gt;
&lt;h2&gt;
  
  
  Why?
&lt;/h2&gt;

&lt;p&gt;I started debugging, it was almost same to the original logic.&lt;br&gt;
After careful observation, the only thing that I changed from the previous parser code was while loops.&lt;/p&gt;

&lt;p&gt;Yep, just changed while loops to for loops.&lt;br&gt;
I wanted to make the logic simple using a for loop and it broke the whole thing!&lt;/p&gt;
&lt;h2&gt;
  
  
  How?
&lt;/h2&gt;

&lt;p&gt;In beginner online tutorials we learn that for loop is just a while loop &lt;strong&gt;with initialization, condition, and increment/decrement in one place.&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;But, its not!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Suppose, you got these 2 programs, one with a while loop and another with a for loop:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;while.c&lt;/code&gt;:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="cp"&gt;#include&amp;lt;stdio.h&amp;gt;&lt;/span&gt;

&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;while&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nb"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"%d\n"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;continue&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;        
        &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;for.c&lt;/code&gt;:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="cp"&gt;#include&amp;lt;stdio.h&amp;gt;&lt;/span&gt;

&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nb"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"%d\n"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;continue&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;        
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Both look same, but the output is different when we compile them:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;while.c output: It prints 1 2 3 4 5 6 7 8 9 and then keeps printing 9 forever.&lt;/li&gt;
&lt;li&gt;for.c output: It prints 1 2 3 4 5 6 7 8 9 and stops.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So, why it is different?&lt;br&gt;
The thing is in while loop, the increment of x is not attached to the loop, so we decide if we want to increment or not.&lt;br&gt;
Every iteration will end with the x incremented, but inside the if condition, we say &lt;code&gt;continue&lt;/code&gt;, that is, without incrementing the x go to the next iteration.&lt;/p&gt;

&lt;p&gt;But, in a for loop,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;initialization&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;condition&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;iteration&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// loop body&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the iteration clause or section of the for loop, what ever we put like for this case &lt;code&gt;increment x&lt;/code&gt;, is run at the end of every iteration even when we use the keyword &lt;code&gt;continue&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  What happened in our code?
&lt;/h3&gt;

&lt;p&gt;In the while loop when x is equal to 9 it does not increment the x and skips to next iteration, so it keeps printing the 9 and never get bigger than 9 so always less than 10.&lt;/p&gt;

&lt;p&gt;In the for loop when x is equal to 9 it increments the x to 10 before continuing that is skipping to the next iteration.&lt;br&gt;
So, it prints 0 to 9 and then the for loop condition is not satisfied, that is, should be less than 10 but its 10 so it stops.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bottom-line
&lt;/h2&gt;

&lt;p&gt;In while loop when you use continue, it will not do anything extra.It just skips to next iteration!&lt;/p&gt;

&lt;p&gt;In for loop when you use continue ,it will run the iteration clause, that is, increments the counter and then runs the continue.&lt;br&gt;
So, be careful!&lt;/p&gt;




</description>
      <category>beginners</category>
      <category>c</category>
      <category>cpp</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>10 problems I face to start a new project!</title>
      <dc:creator>csm</dc:creator>
      <pubDate>Sat, 31 Oct 2026 08:08:45 +0000</pubDate>
      <link>https://dev.to/csm18/10-problems-i-face-to-start-a-new-project-4eie</link>
      <guid>https://dev.to/csm18/10-problems-i-face-to-start-a-new-project-4eie</guid>
      <description>&lt;p&gt;I will just go straight into the points (sorry, problems):&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Idea
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;My mind is really good at not giving ideas and occasionally giving some cool ones&lt;/li&gt;
&lt;li&gt;Some thing that I saw somewhere looks cool, but feels not in my range. &lt;/li&gt;
&lt;li&gt;Some thing that I can implement and is simple and fun but feels waste of time.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2. Fear that someone else already implemented it or is doing it better than me
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The feeling comes like I need to build the best thing in the world or else am done!&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. Naming the project!
&lt;/h2&gt;

&lt;p&gt;This is where all my energy goes! 😂&lt;br&gt;
Either the name is not cool or the name conflicts with an existing one.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Choosing Tech Stack
&lt;/h2&gt;

&lt;p&gt;I know that practical choices should be made but my mind fights with:&lt;br&gt;
cool new niche tech stack vs industry standard vs bla bla bla&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Scope of the project
&lt;/h2&gt;

&lt;p&gt;The focus should be on MVP but mind goes for tiny little unncessary details. &lt;/p&gt;

&lt;h2&gt;
  
  
  6. Project setup
&lt;/h2&gt;

&lt;p&gt;The idea, the motivation all dries up before I even finish the setup!&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Git commit messages
&lt;/h2&gt;

&lt;p&gt;I did my setup commit like 'project setup'&lt;br&gt;
Then I remember  the already commit made by github is 'Initial commit'&lt;br&gt;
Its starting with capital letter, but I like all small letters.&lt;br&gt;
But, wait I also like consistency!&lt;/p&gt;

&lt;p&gt;After some commits:&lt;br&gt;
Should I make a single commit for all the changes I just made or multiple commits: one for a feature, one for updating README, one for updating my name in License.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Code organisation and conventions
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;camelCase vs snake_case vs PascalCase&lt;/li&gt;
&lt;li&gt;output folder name: target vs build vs bin vs ...&lt;/li&gt;
&lt;li&gt;exposing all the contents of a pkg vs explicit one thing&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  9. Writing tests
&lt;/h2&gt;

&lt;p&gt;Still I don't like testing and I don't know how to write tests!&lt;/p&gt;

&lt;h2&gt;
  
  
  10. Half of the project is done and my mind getting distracted by another cool project!
&lt;/h2&gt;

&lt;p&gt;Its fully because of laziness!&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Its just a post to yell at my habits to feel light!&lt;/p&gt;

&lt;p&gt;I read some articles related to this topic and got inspired to carefully observe what my problems are and note them down!&lt;/p&gt;

</description>
      <category>discuss</category>
    </item>
    <item>
      <title>mc- A pre-preprocessor for C for header files generation</title>
      <dc:creator>csm</dc:creator>
      <pubDate>Fri, 30 Oct 2026 10:56:59 +0000</pubDate>
      <link>https://dev.to/csm18/mc-a-pre-preprocessor-for-c-for-header-files-generation-2fch</link>
      <guid>https://dev.to/csm18/mc-a-pre-preprocessor-for-c-for-header-files-generation-2fch</guid>
      <description>&lt;h1&gt;
  
  
  mc
&lt;/h1&gt;

&lt;p&gt;&lt;code&gt;mc&lt;/code&gt; stands for &lt;code&gt;meta-c&lt;/code&gt;:&lt;br&gt;
    A pre-preprocessor for C.&lt;/p&gt;

&lt;p&gt;It generates .h header files for .c files using custom macro syntax.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/csm-clone-wars/mc" rel="noopener noreferrer"&gt;link to repo&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Disclaimer
&lt;/h2&gt;

&lt;p&gt;With mixed feelings of guilt and pride, I want to say that this is a purely vibe-coded app.&lt;br&gt;
But it works exactly the way I wanted it to.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why
&lt;/h2&gt;

&lt;p&gt;In C, as a beginner, its difficult to keep switching between a &lt;code&gt;.c&lt;/code&gt; file and its corresponding &lt;code&gt;.h&lt;/code&gt; file just to update declarations. &lt;code&gt;mc&lt;/code&gt; solves my problem.&lt;/p&gt;

&lt;p&gt;I got the idea from Pascal, where you can write the implementation and interface in the same file.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the comments as macros
&lt;/h2&gt;

&lt;p&gt;Its because,by using comments as macros, code editors don't need a new language extension to recognise plain regular c code.&lt;br&gt;
Best of both worlds.&lt;/p&gt;

&lt;h2&gt;
  
  
  Development Environment
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Operating System: Linux Mint&lt;/li&gt;
&lt;li&gt;Go Toolchain&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Example
&lt;/h2&gt;

&lt;p&gt;The idea is:&lt;br&gt;
In a single .c file using custom comment macro syntax we write all our .h header content and give the file to &lt;code&gt;mc&lt;/code&gt; and it will generate the header file.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;hello.c:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Hello module example!&lt;/span&gt;

&lt;span class="c1"&gt;//@pub&lt;/span&gt;
&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;hello&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;//@end&lt;/span&gt;

&lt;span class="cp"&gt;#include&amp;lt;stdio.h&amp;gt;&lt;/span&gt;

&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;hello&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nb"&gt;puts&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Hello world!"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;main.c:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Enven if empty each .c file should have the @pub macro at the top&lt;/span&gt;
&lt;span class="c1"&gt;//@pub&lt;/span&gt;
&lt;span class="c1"&gt;//@end&lt;/span&gt;

&lt;span class="cp"&gt;#include "hello.h"&lt;/span&gt;

&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;hello&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  MC Rules
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Each .c file should have @pub macro at the top.&lt;/li&gt;
&lt;li&gt;Before @pub macro whitespace characters and single line comments are allowed.&lt;/li&gt;
&lt;li&gt;@pub macro can be empty.&lt;/li&gt;
&lt;li&gt;Anything inside (between the macro comments &lt;code&gt;//@pub&lt;/code&gt; &lt;code&gt;//@end&lt;/code&gt; will go to the .h header file).&lt;/li&gt;
&lt;li&gt;Every generated header file template includes &lt;code&gt;#pragma once&lt;/code&gt; at the top, even if the @pub macro is empty.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Commands
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mc &amp;lt;no args&amp;gt;      -&amp;gt; Print mc version and help
mc -version,  -v  -&amp;gt; Print mc version
mc -help,     -h  -&amp;gt; Print mc commands list
mc -watch,    -w  -&amp;gt; Watch for any file changes and regenerate .h files
mc hi.c main.c    -&amp;gt; Generate .h header files in include/ folder for given .c files
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  License
&lt;/h2&gt;

&lt;p&gt;MIT&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>c</category>
      <category>linux</category>
      <category>showdev</category>
    </item>
    <item>
      <title>sz - view file size</title>
      <dc:creator>csm</dc:creator>
      <pubDate>Sun, 18 Oct 2026 08:07:41 +0000</pubDate>
      <link>https://dev.to/csm18/sz-view-file-size-1me6</link>
      <guid>https://dev.to/csm18/sz-view-file-size-1me6</guid>
      <description>&lt;h1&gt;
  
  
  sz
&lt;/h1&gt;

&lt;p&gt;A Linux utility for viewing file sizes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/csm-clone-wars/sz" rel="noopener noreferrer"&gt;link to repo&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Overview
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;sz&lt;/code&gt; displays the size of a given file in human readable format (KB,MB,GB).&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sz hello.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;4.50 MB
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Development Environment
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Operating System: Linux Mint&lt;/li&gt;
&lt;li&gt;Rust Toolchain&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Building the Project
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;clone the repo&lt;/li&gt;
&lt;li&gt;cd into the cloned repo&lt;/li&gt;
&lt;li&gt;to build:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;cargo build --release
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;the &lt;code&gt;sz&lt;/code&gt; binary will be created under "target/release" folder.&lt;/li&gt;
&lt;li&gt;Add the &lt;code&gt;sz&lt;/code&gt; binary's directory to PATH to use it from anywhere in the terminal.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Commands
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sz &amp;lt;no args&amp;gt;     -&amp;gt; Print sz commands
sz -version, -v  -&amp;gt; Print sz version
sz -help,    -h  -&amp;gt; Print sz commands
sz &amp;lt;file.txt&amp;gt;    -&amp;gt; Print file size
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  License
&lt;/h2&gt;

&lt;p&gt;MIT&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>rust</category>
      <category>linux</category>
      <category>opensource</category>
    </item>
    <item>
      <title>trailing return types in cpp</title>
      <dc:creator>csm</dc:creator>
      <pubDate>Wed, 14 Oct 2026 07:13:29 +0000</pubDate>
      <link>https://dev.to/csm18/trailing-return-types-in-cpp-epd</link>
      <guid>https://dev.to/csm18/trailing-return-types-in-cpp-epd</guid>
      <description>&lt;p&gt;I know that C++ has different versions (standards) and &lt;br&gt;
and from C++11 its called modern C++, because it got many features that made C++ feel like a brand new language or simply modern.&lt;/p&gt;

&lt;p&gt;And it did all this while maintaining backward compatibility!&lt;br&gt;
Still, there are many things people don't like about C++.&lt;br&gt;
For me, especially the lengthy return types that hide the function names.&lt;/p&gt;

&lt;p&gt;For example, suppose you have a function like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;tuple&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;vector&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Diagnostic&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;vector&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
           &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;unordered_map&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
           &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;unordered_map&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt;
&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;vector&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;😅 Can you see where the function name is? &lt;/p&gt;

&lt;p&gt;I've always wanted a feature like the one in modern languages such as Rust and Go, where you write the return type after the function's parameters.&lt;/p&gt;

&lt;p&gt;Guess what? All this time, I didn't know C++ had supported trailing return type syntax since C++11!&lt;/p&gt;

&lt;p&gt;Now the same above function, using trailing return types, would look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="kd"&gt;auto&lt;/span&gt; &lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;vector&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;tuple&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;
    &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;vector&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Diagnostic&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
    &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;vector&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;unordered_map&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;unordered_map&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Function body&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;It has happened many times that C++ already had the features I needed. I just didn't know they existed!&lt;/p&gt;

</description>
      <category>cpp</category>
    </item>
    <item>
      <title>whoami in rust</title>
      <dc:creator>csm</dc:creator>
      <pubDate>Wed, 07 Oct 2026 02:57:41 +0000</pubDate>
      <link>https://dev.to/csm18/whoami-in-rust-1bg7</link>
      <guid>https://dev.to/csm18/whoami-in-rust-1bg7</guid>
      <description>&lt;h1&gt;
  
  
  whoami
&lt;/h1&gt;

&lt;p&gt;A reimplementation of the Linux command &lt;code&gt;whoami&lt;/code&gt; in Rust.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/csm-clone-wars/whoami" rel="noopener noreferrer"&gt;link to repo&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Overview
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;whoami&lt;/code&gt; displays the user name associated with the current effective user ID. Same as &lt;code&gt;id -un&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;whoami
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;csm
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Development Environment
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Operating System: Linux Mint&lt;/li&gt;
&lt;li&gt;Rust Toolchain&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Building the Project
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;clone the repo&lt;/li&gt;
&lt;li&gt;cd into the cloned repo&lt;/li&gt;
&lt;li&gt;to build:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;cargo build --release
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;to build and run:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;cargo run -- -help
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Commands
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;whoami &amp;lt;no args&amp;gt;     -&amp;gt; Print effective userid
whoami -version, -v  -&amp;gt; Print whoami version
whoami -help,    -h  -&amp;gt; Print whoami commands

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  License
&lt;/h2&gt;

&lt;p&gt;MIT&lt;/p&gt;




&lt;h2&gt;
  
  
  What I learned?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Simple command does not mean simple to implement&lt;/li&gt;
&lt;li&gt;For the first time wrote some unsafe rust code with &lt;code&gt;libc&lt;/code&gt; crate.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>rust</category>
      <category>opensource</category>
      <category>linux</category>
      <category>showdev</category>
    </item>
    <item>
      <title>Programming kya hai?</title>
      <dc:creator>csm</dc:creator>
      <pubDate>Sun, 04 Oct 2026 02:06:54 +0000</pubDate>
      <link>https://dev.to/csm18/programming-kya-hai-2pj9</link>
      <guid>https://dev.to/csm18/programming-kya-hai-2pj9</guid>
      <description>&lt;p&gt;Yaha tak aane ke baad, ye &lt;strong&gt;title&lt;/strong&gt; thoda ajeeb lagega 😅&lt;br&gt;
Par ant tak bane rahiye!&lt;/p&gt;
&lt;h2&gt;
  
  
  Programming kya hai?
&lt;/h2&gt;

&lt;p&gt;Sabko pata hai:&lt;br&gt;
aagyakaari &lt;strong&gt;computer&lt;/strong&gt; ko aagya dena!&lt;/p&gt;
&lt;h2&gt;
  
  
  Computer ki bhasha kya hai?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Computer&lt;/strong&gt; sirf &lt;strong&gt;binary&lt;/strong&gt;, yani &lt;strong&gt;0&lt;/strong&gt; aur &lt;strong&gt;1&lt;/strong&gt;, samajhta hai.&lt;/p&gt;
&lt;h2&gt;
  
  
  Programming language kya hai? Aur itni saari kyun hain? 😭
&lt;/h2&gt;

&lt;p&gt;Jese hum insaanon ki bhasha sirf &lt;strong&gt;sound&lt;/strong&gt; hai, wese hi computer ki bhasha sirf &lt;strong&gt;electricity voltage level&lt;/strong&gt; hai.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Higher voltage -&amp;gt; 1&lt;br&gt;
Lower voltage -&amp;gt; 0&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Ab hum &lt;strong&gt;sound&lt;/strong&gt; ko likh nahi sakte, isliye humne &lt;strong&gt;script&lt;/strong&gt; banayi hai. Kuch usi tarah, humne &lt;strong&gt;assembly language&lt;/strong&gt; banayi hai!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Assembly&lt;/strong&gt; bhasha &lt;strong&gt;machine&lt;/strong&gt; bhasha ke bahut nazdeek hai, isliye mushkil hai:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;; Linux x86-64 with NASM
section .data
    msg db "Hello, World!", 10
    len equ $ - msg

section .text
    global _start

_start:
    mov rax, 1          ; sys_write
    mov rdi, 1          ; stdout
    mov rsi, msg        ; message
    mov rdx, len        ; length
    syscall

    mov rax, 60         ; sys_exit
    xor rdi, rdi        ; exit code 0
    syscall
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Tabhi humne &lt;strong&gt;high-level languages&lt;/strong&gt; banayi hain, taaki &lt;strong&gt;program&lt;/strong&gt; likhna aasaan ho.&lt;br&gt;
Jese: &lt;strong&gt;C, C++, Rust, Go, Python, JavaScript&lt;/strong&gt;, aadi.&lt;/p&gt;
&lt;h2&gt;
  
  
  Programming languages kitne tarah ke hote hain?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Compiled (C,C++,Rust,Go)&lt;/li&gt;
&lt;li&gt;Interpreted (Python, Ruby)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Compiled&lt;/strong&gt; yani hamara likha hua &lt;strong&gt;code&lt;/strong&gt;, &lt;strong&gt;binary&lt;/strong&gt; me badal kar ek &lt;strong&gt;file&lt;/strong&gt; me &lt;strong&gt;save&lt;/strong&gt; karte hain.&lt;br&gt;
Wo &lt;strong&gt;file&lt;/strong&gt; seedha hum chala sakte hain.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Jese, &lt;strong&gt;packed food items&lt;/strong&gt; ki tarah, seedha kha sakte hain.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Interpreted&lt;/strong&gt; matlab jab hum kahenge, tab us waqt &lt;strong&gt;interpreter&lt;/strong&gt; hamare likhe &lt;strong&gt;code&lt;/strong&gt; ko &lt;strong&gt;line by line&lt;/strong&gt; badal kar chalayega.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Jese, garam-garam dosa &lt;strong&gt;hotel&lt;/strong&gt; me banakar dete hain, aur hum wahi par khaate hain.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;
  
  
  Hello World Program
&lt;/h2&gt;

&lt;p&gt;To, hum kaha par the?&lt;/p&gt;

&lt;p&gt;Go me &lt;strong&gt;Hello World Program&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="s2"&gt;"fmt"&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Pranaam 🙏🙏🙏🙏"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Humne ab tak seekha hai ki har Go program me ek &lt;strong&gt;main package&lt;/strong&gt; hoga, jisme &lt;strong&gt;main function&lt;/strong&gt; se hamara program shuru hoga.&lt;/p&gt;

&lt;p&gt;Yaha par sirf ek line hai &lt;strong&gt;main function&lt;/strong&gt; ke andar, jo &lt;strong&gt;"Pranaam 🙏🙏🙏🙏"&lt;/strong&gt; ko print karegi.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;fmt&lt;/strong&gt; ek package hai jo Go ke saath aata hai, jismein &lt;strong&gt;Println()&lt;/strong&gt; ek function hai, jiska kaam text ko terminal par print karna hai.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;fmt package&lt;/strong&gt; &lt;strong&gt;standard library&lt;/strong&gt; ka hissa hai.&lt;/p&gt;

&lt;h2&gt;
  
  
  Kya hum bina library ke code likh sakte hain?
&lt;/h2&gt;

&lt;p&gt;Jo students beginners hain, unmein kuch logon ko ye bhram hai ki agar hum bina kisi &lt;strong&gt;library&lt;/strong&gt; ki madad ke saara code likhenge, tabhi hum programmer ya developer banenge.&lt;/p&gt;

&lt;p&gt;Par ek udaharan ke saath is bhram ko door karte hain:&lt;/p&gt;

&lt;p&gt;Hamare ghar ek baar ek &lt;strong&gt;carpenter uncle&lt;/strong&gt; aaye the &lt;strong&gt;door&lt;/strong&gt; lagane ke liye.&lt;br&gt;
Wo sirf bana-banaya &lt;strong&gt;door&lt;/strong&gt; lagate hain.&lt;br&gt;
&lt;strong&gt;Door&lt;/strong&gt; humein hi kisi dukaan se khareedna padta hai.&lt;/p&gt;

&lt;p&gt;Lekin purane zamaane me &lt;strong&gt;carpenter&lt;/strong&gt; khud ghar aakar wahin par lakdi kaat kar &lt;strong&gt;door&lt;/strong&gt; banate the aur phir &lt;strong&gt;fit&lt;/strong&gt; karte the.&lt;/p&gt;

&lt;p&gt;Is zamaane me na hamare paas waqt hai, na paise, &lt;strong&gt;door&lt;/strong&gt; banwa kar lagwane ke liye.&lt;/p&gt;

&lt;p&gt;To jo uncle hamare ghar aaye the, wo bhi &lt;strong&gt;carpenter&lt;/strong&gt; hain, aur jo &lt;strong&gt;shop&lt;/strong&gt; me &lt;strong&gt;door&lt;/strong&gt; banate hain, wo bhi &lt;strong&gt;carpenter&lt;/strong&gt; hain.&lt;br&gt;
Bas unka &lt;strong&gt;kaam&lt;/strong&gt; alag hai.&lt;/p&gt;

&lt;p&gt;Waise hi, &lt;strong&gt;Python&lt;/strong&gt; me &lt;strong&gt;code&lt;/strong&gt; likhne wale bhi &lt;strong&gt;programmer&lt;/strong&gt; hain aur &lt;strong&gt;Python&lt;/strong&gt; ki &lt;strong&gt;libraries&lt;/strong&gt; likhne wale bhi &lt;strong&gt;programmer&lt;/strong&gt; hain.&lt;/p&gt;

&lt;p&gt;Jis &lt;strong&gt;domain&lt;/strong&gt; me humein ruchi ho, usi me jaana chahiye!&lt;/p&gt;

&lt;p&gt;Aaj ke liye bas itna hi 🫡&lt;/p&gt;




&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Kavi&lt;/strong&gt;: Ab waqt hai meri &lt;strong&gt;all-time favorite kavita&lt;/strong&gt; ke liye!&lt;br&gt;
Sunna chahoge?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Shrota&lt;/strong&gt;: Bilkul!&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Kavi&lt;/strong&gt;: Arz kiya hai,&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;हार को चुराने से चोर बनोगे
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Shrota&lt;/strong&gt;: Thik hai thik hai, aage?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Kavi&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;और हार को हराने से वीर बनोगे
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Shrota&lt;/strong&gt;: 🥶&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>go</category>
      <category>hindi</category>
      <category>tutorial</category>
      <category>hinglish</category>
    </item>
    <item>
      <title>pwd in rust</title>
      <dc:creator>csm</dc:creator>
      <pubDate>Fri, 02 Oct 2026 05:29:38 +0000</pubDate>
      <link>https://dev.to/csm18/pwd-in-rust-3i5p</link>
      <guid>https://dev.to/csm18/pwd-in-rust-3i5p</guid>
      <description>&lt;p&gt;A reimplementation of the Linux command pwd (Print Working Directory) in Rust.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/csm-clone-wars/pwd/tree/main" rel="noopener noreferrer"&gt;link to repo&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Overview
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;pwd&lt;/code&gt; displays the full path of the directory you are currently in.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;pwd&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;/home/csm/Documents
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Development Environment
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Operating System: Linux Mint&lt;/li&gt;
&lt;li&gt;Rust Toolchain&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Building the Project
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;clone the repo&lt;/li&gt;
&lt;li&gt;cd into the cloned repo&lt;/li&gt;
&lt;li&gt;to build:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;cargo build --release
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;to build and run:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;cargo run -- -help
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Commands
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    pwd &amp;lt;no args&amp;gt;        -&amp;gt; Print working directory logical path
    pwd -version,  -v    -&amp;gt; Print pwd version
    pwd -help,     -h    -&amp;gt; Print pwd commands list
    pwd -logical,  -l    -&amp;gt; Print working directory logical path
    pwd -physical, -p    -&amp;gt; Print working directory physical path (resolving sym-links)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  License
&lt;/h2&gt;

&lt;p&gt;MIT&lt;/p&gt;

</description>
      <category>rust</category>
      <category>showdev</category>
      <category>linux</category>
      <category>devtools</category>
    </item>
    <item>
      <title>Vim Basics</title>
      <dc:creator>csm</dc:creator>
      <pubDate>Sat, 26 Sep 2026 02:21:08 +0000</pubDate>
      <link>https://dev.to/csm18/vim-basics-4l30</link>
      <guid>https://dev.to/csm18/vim-basics-4l30</guid>
      <description>&lt;p&gt;Just the basics you need to get started.&lt;br&gt;
Also for those who are trapped in classic vim situation, where you don't know how to quit!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Vim is a powerful, keyboard-driven command-line text editor (an improved version of the classic Unix “vi”) used for efficiently editing code and plain-text files.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;
  
  
  Things you need
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Linux Mint or Ubuntu&lt;/li&gt;
&lt;li&gt;Vim 8.2 or above&lt;/li&gt;
&lt;li&gt;Alacritty terminal (Why? Just for feel!)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Install
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo apt update &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; sudo apt install vim
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Open a file in Vim
&lt;/h2&gt;

&lt;p&gt;Suppose you are inside a folder called &lt;code&gt;hello&lt;/code&gt; and it has a file &lt;code&gt;hello.txt&lt;/code&gt;.&lt;br&gt;
You open the file in Vim:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;vim hello.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Modes of Vim
&lt;/h2&gt;

&lt;p&gt;In vim we have modes.&lt;br&gt;
When you open a file the default mode is Normal mode.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Normal mode  -&amp;gt; Esc key
Insert mode  -&amp;gt; i
Command mode -&amp;gt; Esc key then :
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  What the heck are modes?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;When you press '&lt;strong&gt;i&lt;/strong&gt;', you can type in the editor, thats Insert mode.&lt;/li&gt;
&lt;li&gt;When you press '&lt;strong&gt;Esc&lt;/strong&gt;' key, you go back into Normal mode where you can view the file without typing.&lt;/li&gt;
&lt;li&gt;When you press '&lt;strong&gt;:&lt;/strong&gt;' inside normal mode, that is Command mode.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For beginners, insert mode is for you to type.&lt;br&gt;
Later you will learn the powers of normal mode where you can use Vim's shortcuts to edit the file super hyper fastly!&lt;br&gt;
Command mode, for now, is for saving the changes you made and to quit and get out of Vim.&lt;/p&gt;
&lt;h2&gt;
  
  
  Quit, Save, and others
&lt;/h2&gt;

&lt;p&gt;First, press '&lt;strong&gt;Esc&lt;/strong&gt;' to ensure you are in Normal mode.&lt;br&gt;
Then:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To just quit:
Type &lt;code&gt;:q&lt;/code&gt; then press &lt;code&gt;Enter&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;To just save:
Type &lt;code&gt;:w&lt;/code&gt; then press &lt;code&gt;Enter&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;To save and quit at once:
Type &lt;code&gt;:wq&lt;/code&gt; then press &lt;code&gt;Enter&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;To quit without saving:
Type &lt;code&gt;:q!&lt;/code&gt; then press &lt;code&gt;Enter&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Example
&lt;/h2&gt;

&lt;p&gt;1) Open the &lt;code&gt;hello.txt&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;vim hello.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2) Type some text:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Press &lt;code&gt;i&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Then type this text:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;hello world!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3) Save the changes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Press &lt;code&gt;Esc&lt;/code&gt; to come out of insert mode&lt;/li&gt;
&lt;li&gt;Type &lt;code&gt;:w&lt;/code&gt; and press &lt;code&gt;Enter&lt;/code&gt; to save the changes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;4) Quit:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Type &lt;code&gt;:q&lt;/code&gt; and press &lt;code&gt;Enter&lt;/code&gt; to quit&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Classic 'Unable To Quit Vim' Situation
&lt;/h2&gt;

&lt;p&gt;If you are someone who just want to quit, then:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Press &lt;code&gt;Esc&lt;/code&gt; then type &lt;code&gt;:q!&lt;/code&gt; then press &lt;code&gt;Enter&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;Thats it! 🥶&lt;/p&gt;

</description>
      <category>vim</category>
    </item>
  </channel>
</rss>
