<?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: Moksh Upadhyay</title>
    <description>The latest articles on DEV Community by Moksh Upadhyay (@moksh57).</description>
    <link>https://dev.to/moksh57</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%2F757092%2F8764eb13-5d68-474b-869e-4361b29f0e08.jpeg</url>
      <title>DEV Community: Moksh Upadhyay</title>
      <link>https://dev.to/moksh57</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/moksh57"/>
    <language>en</language>
    <item>
      <title>printf() and scanf() in C: Understanding Input and Output</title>
      <dc:creator>Moksh Upadhyay</dc:creator>
      <pubDate>Mon, 22 Jun 2026 18:07:53 +0000</pubDate>
      <link>https://dev.to/moksh57/printf-and-scanf-in-c-understanding-input-and-output-l6n</link>
      <guid>https://dev.to/moksh57/printf-and-scanf-in-c-understanding-input-and-output-l6n</guid>
      <description>&lt;p&gt;One of the first things every C programmer learns is how to interact with users. A program that cannot receive input or display output is not very useful.&lt;/p&gt;

&lt;p&gt;In C, this interaction is handled primarily by two standard library functions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;printf()&lt;/code&gt; for output&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;scanf()&lt;/code&gt; for input&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's see how they work and why they are so important.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is printf()?
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;printf()&lt;/code&gt; stands for &lt;strong&gt;Print Formatted&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;It is used to display output on the screen.&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="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;span class="cp"&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="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Hello, World!"&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;Output:&lt;br&gt;
&lt;/p&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;The function can also display variable values using format specifiers.&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="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;23&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Age = %d"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

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

&lt;/div&gt;



&lt;p&gt;Here, &lt;code&gt;%d&lt;/code&gt; tells &lt;code&gt;printf()&lt;/code&gt; to display an integer.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is scanf()?
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;scanf()&lt;/code&gt; stands for &lt;strong&gt;Scan Formatted&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;It reads input from the keyboard and stores it in variables.&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="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;scanf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"%d"&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;age&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;&amp;amp;&lt;/code&gt; operator is important because &lt;code&gt;scanf()&lt;/code&gt; needs the memory address where the value should be stored.&lt;/p&gt;

&lt;p&gt;Complete example:&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="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;span class="cp"&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="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Enter your age: "&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;scanf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"%d"&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;age&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"You entered: %d"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;age&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;
  
  
  Common Format Specifiers
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Specifier&lt;/th&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;%d&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;int&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;%f&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;float&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;%lf&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;double&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;%c&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;char&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;%s&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;string&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Example:&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="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;salary&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;45000&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kt"&gt;char&lt;/span&gt; &lt;span class="n"&gt;grade&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sc"&gt;'A'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"%f&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;salary&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"%c&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;grade&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  A Common Beginner Mistake
&lt;/h2&gt;

&lt;p&gt;Many beginners forget the &lt;code&gt;&amp;amp;&lt;/code&gt; operator.&lt;/p&gt;

&lt;p&gt;Incorrect:&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="n"&gt;scanf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"%d"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;age&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Typical compiler warning:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;warning: format '%d' expects argument of type 'int *'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Correct:&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="n"&gt;scanf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"%d"&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;age&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  How scanf() and printf() Work Internally
&lt;/h2&gt;

&lt;p&gt;A useful mental model is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Keyboard
   ↓
scanf()
   ↓
Memory
   ↓
printf()
   ↓
Monitor
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When a user enters a value:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;scanf()&lt;/code&gt; reads the input.&lt;/li&gt;
&lt;li&gt;The value is stored in memory.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;printf()&lt;/code&gt; reads the value from memory.&lt;/li&gt;
&lt;li&gt;The result is displayed on the screen.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Understanding this flow makes later topics such as pointers and memory management much easier.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;printf()&lt;/code&gt; displays output.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;scanf()&lt;/code&gt; accepts input.&lt;/li&gt;
&lt;li&gt;Format specifiers determine how data is interpreted.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;&amp;amp;&lt;/code&gt; operator provides a memory address.&lt;/li&gt;
&lt;li&gt;These functions are fundamental to almost every beginner C program.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>programming</category>
      <category>beginners</category>
    </item>
    <item>
      <title>What are you learning?

Drop your Comments</title>
      <dc:creator>Moksh Upadhyay</dc:creator>
      <pubDate>Tue, 09 Jun 2026 19:09:37 +0000</pubDate>
      <link>https://dev.to/moksh57/what-are-you-learningdrop-your-comments-31fl</link>
      <guid>https://dev.to/moksh57/what-are-you-learningdrop-your-comments-31fl</guid>
      <description></description>
      <category>beginners</category>
      <category>discuss</category>
      <category>learning</category>
      <category>watercooler</category>
    </item>
    <item>
      <title>Most Beginners Learn C Program Structure Wrong — Here's the Correct Layout</title>
      <dc:creator>Moksh Upadhyay</dc:creator>
      <pubDate>Tue, 09 Jun 2026 19:08:20 +0000</pubDate>
      <link>https://dev.to/moksh57/most-beginners-learn-c-program-structure-wrong-heres-the-correct-layout-4lj</link>
      <guid>https://dev.to/moksh57/most-beginners-learn-c-program-structure-wrong-heres-the-correct-layout-4lj</guid>
      <description>&lt;p&gt;Most beginners think a C program is just a collection of statements written from top to bottom.&lt;/p&gt;

&lt;p&gt;In reality, every C program follows a structure. Understanding this structure makes your code easier to read, easier to debug, and easier to scale as programs become larger.&lt;/p&gt;

&lt;p&gt;In this article, we'll break down the different sections of a C program, understand why they are arranged in a specific order, and build a complete example.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Does Program Structure Matter?
&lt;/h2&gt;

&lt;p&gt;Imagine building a house without a blueprint.&lt;/p&gt;

&lt;p&gt;You might eventually get walls, doors, and windows in place, but the process would be confusing and error-prone.&lt;/p&gt;

&lt;p&gt;A C program works the same way.&lt;/p&gt;

&lt;p&gt;Each section has a specific purpose, and organizing them properly helps both the programmer and the compiler understand the code.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A well-structured C program is easier to maintain, debug, and expand.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Components of a C Program
&lt;/h2&gt;

&lt;p&gt;A typical C program is organized into the following sections:&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.amazonaws.com%2Fuploads%2Farticles%2Froi69m62a9bd6bq6ngwq.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.amazonaws.com%2Fuploads%2Farticles%2Froi69m62a9bd6bq6ngwq.png" alt=" " width="800" height="1067"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's understand each part.&lt;/p&gt;




&lt;h2&gt;
  
  
  Documentation Section
&lt;/h2&gt;

&lt;p&gt;The documentation section contains comments that describe the purpose of the program.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="cm"&gt;/* Program: Student Management System
   Author: Moksh Upadhyay
*/&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Comments are ignored by the compiler but help developers understand the code.&lt;/p&gt;




&lt;h2&gt;
  
  
  Header Files
&lt;/h2&gt;

&lt;p&gt;Header files are included using the &lt;code&gt;#include&lt;/code&gt; directive.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;



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

&lt;/div&gt;



&lt;p&gt;Header files provide declarations for library functions.&lt;/p&gt;

&lt;p&gt;Without &lt;code&gt;stdio.h&lt;/code&gt;, functions such as &lt;code&gt;printf()&lt;/code&gt; and &lt;code&gt;scanf()&lt;/code&gt; would not be available.&lt;/p&gt;




&lt;h2&gt;
  
  
  Constants and Macros
&lt;/h2&gt;

&lt;p&gt;Constants are values that do not change during program execution.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="cp"&gt;#define PI 3.14159
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using constants improves readability and makes code easier to maintain.&lt;/p&gt;




&lt;h2&gt;
  
  
  Global Variables
&lt;/h2&gt;

&lt;p&gt;Global variables are declared outside all functions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;totalStudents&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;They can be accessed from multiple functions throughout the program.&lt;/p&gt;

&lt;p&gt;Use global variables carefully to avoid unnecessary dependencies between functions.&lt;/p&gt;




&lt;h2&gt;
  
  
  The main() Function
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;main()&lt;/code&gt; function is the entry point of every C program.&lt;/p&gt;

&lt;p&gt;Execution always starts here.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&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="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Hello, World!"&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;The operating system calls &lt;code&gt;main()&lt;/code&gt; when the program starts.&lt;/p&gt;




&lt;h2&gt;
  
  
  User-Defined Functions
&lt;/h2&gt;

&lt;p&gt;User-defined functions help break large programs into smaller, reusable pieces.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Welcome to C Programming&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&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;Instead of writing the same code repeatedly, you can place it inside a function and call it whenever needed.&lt;/p&gt;




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



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="cm"&gt;/* Documentation */&lt;/span&gt;
&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;
&lt;span class="cm"&gt;/* Constants */&lt;/span&gt;
&lt;span class="cp"&gt;#define PI 3.14159
&lt;/span&gt;
&lt;span class="cm"&gt;/* Global Variable */&lt;/span&gt;
&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;totalStudents&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="cm"&gt;/* Function Prototype */&lt;/span&gt;
&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;greet&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="cm"&gt;/* Main Function */&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="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Students = %d&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;totalStudents&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="n"&gt;greet&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;span class="cm"&gt;/* User Function */&lt;/span&gt;
&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;greet&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;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Welcome to C Programming&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&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;h2&gt;
  
  
  Common Beginner Mistakes
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Forgetting Header Files
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Hello"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Without:&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="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;the compiler may generate warnings or errors.&lt;/p&gt;

&lt;h3&gt;
  
  
  Writing Everything Inside main()
&lt;/h3&gt;

&lt;p&gt;Many beginners place all logic inside one function.&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="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="c1"&gt;// Hundreds of lines of code&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A better approach is to separate logic into smaller functions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Using void main()
&lt;/h3&gt;

&lt;p&gt;Prefer:&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="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="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;over:&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="kt"&gt;void&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;int main()&lt;/code&gt; follows the C standard and allows the program to return a status code to the operating system.&lt;/p&gt;




&lt;h2&gt;
  
  
  Frequently Asked Questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Is Every Section Mandatory?
&lt;/h3&gt;

&lt;p&gt;No.&lt;/p&gt;

&lt;p&gt;A small program may only contain:&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="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;span class="cp"&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="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;However, larger programs often use all sections.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Are Functions Placed After main()?
&lt;/h3&gt;

&lt;p&gt;This is a common style.&lt;/p&gt;

&lt;p&gt;The compiler simply needs to know about the function before it is used, often through a function prototype.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can a Program Work Without Global Variables?
&lt;/h3&gt;

&lt;p&gt;Yes.&lt;/p&gt;

&lt;p&gt;Many professional applications minimize the use of global variables to improve maintainability.&lt;/p&gt;




&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;The structure of a C program is more than a formatting convention.&lt;/p&gt;

&lt;p&gt;It provides a logical organization that helps programmers write cleaner code and helps the compiler understand the program correctly.&lt;/p&gt;

&lt;p&gt;Once you understand:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Documentation&lt;/li&gt;
&lt;li&gt;Header Files&lt;/li&gt;
&lt;li&gt;Constants &amp;amp; Macros&lt;/li&gt;
&lt;li&gt;Global Variables&lt;/li&gt;
&lt;li&gt;&lt;code&gt;main()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;User-Defined Functions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;you've built a strong foundation for learning the rest of C programming.&lt;/p&gt;




&lt;h2&gt;
  
  
  What's Next?
&lt;/h2&gt;

&lt;p&gt;If you're learning C, continue with:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;printf()&lt;/code&gt; and &lt;code&gt;scanf()&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Variables in C&lt;/li&gt;
&lt;li&gt;Data Types in C&lt;/li&gt;
&lt;li&gt;Operators in C&lt;/li&gt;
&lt;li&gt;Functions in C&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;These topics build directly on the structure you've learned today.&lt;/p&gt;

&lt;p&gt;Which section of a C program was hardest for you to understand when you started?&lt;/p&gt;

&lt;p&gt;Let me know in the comments.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>c</category>
      <category>architecture</category>
      <category>beginners</category>
    </item>
    <item>
      <title>What Happens Before Your C Program Reaches the CPU?</title>
      <dc:creator>Moksh Upadhyay</dc:creator>
      <pubDate>Sat, 30 May 2026 19:14:05 +0000</pubDate>
      <link>https://dev.to/moksh57/what-happens-before-your-c-program-reaches-the-cpu-42jg</link>
      <guid>https://dev.to/moksh57/what-happens-before-your-c-program-reaches-the-cpu-42jg</guid>
      <description>&lt;p&gt;Most developers know how to write C code.&lt;/p&gt;

&lt;p&gt;Far fewer know what actually happens after they press &lt;strong&gt;Run&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;A common mental model looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Write Code
    ↓
Click Run
    ↓
Get Output
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Simple. Intuitive. Completely wrong.&lt;/p&gt;

&lt;p&gt;Between your source code and the CPU sits an entire toolchain. Before a processor executes a single instruction, your code passes through preprocessing, compilation, assembly, linking, and loading.&lt;/p&gt;

&lt;p&gt;Understanding this pipeline explains:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Why compiler errors happen&lt;/li&gt;
&lt;li&gt;Why linker errors happen&lt;/li&gt;
&lt;li&gt;What object files are&lt;/li&gt;
&lt;li&gt;How libraries work&lt;/li&gt;
&lt;li&gt;What GCC is actually doing&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's walk through the complete journey.&lt;/p&gt;




&lt;h1&gt;
  
  
  The Complete Pipeline
&lt;/h1&gt;

&lt;p&gt;A C program typically moves through the following stages:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;main.c
   ↓
Preprocessor ───► main.i
   ↓
Compiler ───────► main.s
   ↓
Assembler ──────► main.o
   ↓
Linker ─────────► app
   ↓
Loader ─────────► Memory
   ↓
CPU ────────────► Execution
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each stage has one job.&lt;/p&gt;

&lt;p&gt;Each stage produces output consumed by the next.&lt;/p&gt;




&lt;h1&gt;
  
  
  Stage 1: The Preprocessor
&lt;/h1&gt;

&lt;p&gt;The compiler is not the first tool that touches your code.&lt;/p&gt;

&lt;p&gt;The preprocessor runs before compilation begins.&lt;/p&gt;

&lt;p&gt;Consider:&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="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;
#define PI 3.14
&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="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Hello World"&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;The preprocessor handles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Header inclusion (&lt;code&gt;#include&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Macro expansion (&lt;code&gt;#define&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Comment removal&lt;/li&gt;
&lt;li&gt;Conditional compilation (&lt;code&gt;#ifdef&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&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="cp"&gt;#define PI 3.14
&lt;/span&gt;
&lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;radius&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;PI&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;becomes:&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="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;radius&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;14&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;before compilation even starts.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;main.i
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;View it yourself:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gcc &lt;span class="nt"&gt;-E&lt;/span&gt; main.c &lt;span class="nt"&gt;-o&lt;/span&gt; main.i
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  Stage 2: The Compiler
&lt;/h1&gt;

&lt;p&gt;The compiler's job is much more than translation.&lt;/p&gt;

&lt;p&gt;It performs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Lexical analysis&lt;/li&gt;
&lt;li&gt;Syntax analysis&lt;/li&gt;
&lt;li&gt;Semantic analysis&lt;/li&gt;
&lt;li&gt;Optimization&lt;/li&gt;
&lt;li&gt;Code generation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example:&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="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;z&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;might become:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;MOV AX, y
ADD AX, z
MOV x, AX
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The compiler also catches errors such as:&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="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Hello"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Missing parentheses.&lt;/p&gt;

&lt;p&gt;Type mismatches.&lt;/p&gt;

&lt;p&gt;Undeclared variables.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;main.s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Generate it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gcc &lt;span class="nt"&gt;-S&lt;/span&gt; main.c &lt;span class="nt"&gt;-o&lt;/span&gt; main.s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  Stage 3: The Assembler
&lt;/h1&gt;

&lt;p&gt;Assembly language is readable by humans.&lt;/p&gt;

&lt;p&gt;CPUs cannot execute it directly.&lt;/p&gt;

&lt;p&gt;The assembler converts assembly instructions into machine code.&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 plaintext"&gt;&lt;code&gt;ADD AX, BX
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;becomes something closer to:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;main.o
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Generate it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gcc &lt;span class="nt"&gt;-c&lt;/span&gt; main.s &lt;span class="nt"&gt;-o&lt;/span&gt; main.o
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At this point you have machine code, but not a complete executable.&lt;/p&gt;




&lt;h1&gt;
  
  
  Stage 4: The Linker
&lt;/h1&gt;

&lt;p&gt;This is where many developers get confused.&lt;/p&gt;

&lt;p&gt;Suppose your code contains:&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="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Hello"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The compiler verifies that &lt;code&gt;printf()&lt;/code&gt; exists.&lt;/p&gt;

&lt;p&gt;The assembler creates machine code referencing it.&lt;/p&gt;

&lt;p&gt;But where is the actual implementation?&lt;/p&gt;

&lt;p&gt;The linker finds it.&lt;/p&gt;

&lt;p&gt;It combines:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Your object files&lt;/li&gt;
&lt;li&gt;Standard libraries&lt;/li&gt;
&lt;li&gt;Third-party libraries&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;and produces a complete executable.&lt;/p&gt;

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

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

&lt;/div&gt;






&lt;h1&gt;
  
  
  Why "Undefined Reference" Happens
&lt;/h1&gt;

&lt;p&gt;One of the most common C errors:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;undefined reference to 'myFunction'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is not a compiler error.&lt;/p&gt;

&lt;p&gt;It is a linker error.&lt;/p&gt;

&lt;p&gt;Typical causes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Function declared but not defined&lt;/li&gt;
&lt;li&gt;Source file not compiled&lt;/li&gt;
&lt;li&gt;Library not linked&lt;/li&gt;
&lt;li&gt;Incorrect linker flags&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A useful rule:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The compiler checks correctness. The linker checks completeness.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h1&gt;
  
  
  Stage 5: The Loader
&lt;/h1&gt;

&lt;p&gt;After linking, you finally have an executable.&lt;/p&gt;

&lt;p&gt;But the CPU still cannot execute a file sitting on disk.&lt;/p&gt;

&lt;p&gt;The operating system loader:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Allocates memory&lt;/li&gt;
&lt;li&gt;Loads instructions into RAM&lt;/li&gt;
&lt;li&gt;Maps shared libraries&lt;/li&gt;
&lt;li&gt;Initializes the process&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Only then does execution begin.&lt;/p&gt;




&lt;h1&gt;
  
  
  What GCC Actually Does
&lt;/h1&gt;

&lt;p&gt;Most developers use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gcc main.c &lt;span class="nt"&gt;-o&lt;/span&gt; app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Behind that single command, GCC runs multiple stages.&lt;/p&gt;

&lt;p&gt;You can execute them manually:&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="o"&gt;[&lt;/span&gt;Preprocessor]
gcc &lt;span class="nt"&gt;-E&lt;/span&gt; main.c &lt;span class="nt"&gt;-o&lt;/span&gt; main.i

&lt;span class="o"&gt;[&lt;/span&gt;Compiler]
gcc &lt;span class="nt"&gt;-S&lt;/span&gt; main.i &lt;span class="nt"&gt;-o&lt;/span&gt; main.s

&lt;span class="o"&gt;[&lt;/span&gt;Assembler]
gcc &lt;span class="nt"&gt;-c&lt;/span&gt; main.s &lt;span class="nt"&gt;-o&lt;/span&gt; main.o

&lt;span class="o"&gt;[&lt;/span&gt;Linker]
gcc main.o &lt;span class="nt"&gt;-o&lt;/span&gt; app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Understanding these commands makes debugging much easier.&lt;/p&gt;




&lt;h1&gt;
  
  
  Compiler Error vs Linker Error
&lt;/h1&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;Stage&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Compiler Error&lt;/td&gt;
&lt;td&gt;Compilation&lt;/td&gt;
&lt;td&gt;Invalid code&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Linker Error&lt;/td&gt;
&lt;td&gt;Linking&lt;/td&gt;
&lt;td&gt;Missing implementation&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Examples:&lt;/p&gt;

&lt;p&gt;Compiler Error:&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="n"&gt;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Hello"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Linker Error:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;undefined reference to 'test'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Remember:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Compiler = correctness&lt;br&gt;
Linker = completeness&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h1&gt;
  
  
  Key Takeaways
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;The CPU cannot understand C directly.&lt;/li&gt;
&lt;li&gt;The preprocessor handles directives.&lt;/li&gt;
&lt;li&gt;The compiler analyzes and transforms code.&lt;/li&gt;
&lt;li&gt;The assembler generates machine code.&lt;/li&gt;
&lt;li&gt;The linker builds a complete executable.&lt;/li&gt;
&lt;li&gt;The loader places the program into memory.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;undefined reference&lt;/code&gt; is a linker error.&lt;/li&gt;
&lt;li&gt;GCC automates the entire pipeline.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The next time you press &lt;strong&gt;Run&lt;/strong&gt;, you'll know exactly what happens before your program reaches the CPU.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;What part of the compilation pipeline confused you the most when you started learning C?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;If you found this useful, you can read more articles on C Programming, Java, and Software Engineering at:&lt;br&gt;
Originally published on Moksh eLearning Blog.&lt;/p&gt;

&lt;p&gt;Full article: &lt;a href="https://mokshelearning.blogspot.com/2026/05/how-c-compilation-process-works.html" rel="noopener noreferrer"&gt;C Compliation Process&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Additional content on C Programming, Java, Spring Boot, and Software Engineering:&lt;br&gt;
&lt;a href="https://mokshelearning.blogspot.com" rel="noopener noreferrer"&gt;https://mokshelearning.blogspot.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>c</category>
      <category>computerscience</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How I Built My Developer Portfolio (React + Netlify) and What I Improved</title>
      <dc:creator>Moksh Upadhyay</dc:creator>
      <pubDate>Tue, 10 Mar 2026 18:00:05 +0000</pubDate>
      <link>https://dev.to/moksh57/how-i-built-my-developer-portfolio-react-netlify-and-what-i-improved-4mdg</link>
      <guid>https://dev.to/moksh57/how-i-built-my-developer-portfolio-react-netlify-and-what-i-improved-4mdg</guid>
      <description>&lt;p&gt;Recently I spent some time refining my developer portfolio.&lt;/p&gt;

&lt;p&gt;Instead of treating it like just another “portfolio page”, I tried to approach it the same way I would approach a real product — thinking about performance, structure, and maintainability.&lt;/p&gt;

&lt;p&gt;The result was a series of small improvements that made the site much cleaner and more production-ready.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Stack I Used&lt;/strong&gt;&lt;br&gt;
The portfolio itself is built using a pretty simple stack:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;React for the UI&lt;/li&gt;
&lt;li&gt;Netlify for deployment&lt;/li&gt;
&lt;li&gt;Vanilla CSS for styling&lt;/li&gt;
&lt;li&gt;JavaScript for interactions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I intentionally kept the stack lightweight so the site remains fast and easy to maintain.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Performance Improvements&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;One of the first things I noticed was the size of some assets.&lt;/p&gt;

&lt;p&gt;For example, my profile image was originally 4.7MB, which is way too heavy for a simple landing page.&lt;/p&gt;

&lt;p&gt;After optimizing it, I reduced it to 95KB without noticeable quality loss.&lt;br&gt;
That alone improved the loading experience quite a bit.&lt;/p&gt;

&lt;p&gt;I also cleaned up unused assets and simplified the HTML structure to reduce the final bundle size.&lt;/p&gt;

&lt;p&gt;Small changes like this make a big difference.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Handling SPA Routing on Netlify&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;React applications commonly use client-side routing. When deployed on static hosting platforms, refreshing a routed page may result in a 404 error.&lt;/p&gt;

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

&lt;p&gt;&lt;code&gt;/project/1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To address this, Netlify redirect rules can be configured so all routes fallback to the main application entry point.&lt;/p&gt;

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

&lt;p&gt;&lt;code&gt;/*  /index.html  200&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This allows the React router to manage navigation correctly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Small UI Improvements&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I also added a couple of small UI touches.&lt;/p&gt;

&lt;p&gt;The scrollbar changes color based on the theme (light or dark mode), which keeps the interface consistent.&lt;/p&gt;

&lt;p&gt;I also made the favicon theme-aware, so it stays visible whether the browser is in light or dark mode.&lt;/p&gt;

&lt;p&gt;They’re small details, but they help the site feel more polished.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Spam Protection for the Contact Form&lt;/strong&gt;&lt;br&gt;
Instead of adding CAPTCHA, I implemented a honeypot field in the contact form.&lt;/p&gt;

&lt;p&gt;Basically:&lt;br&gt;
A hidden field is added to the form, Bots usually fill it automatically. If that field has data, the submission gets rejected&lt;br&gt;
It helps filter spam without affecting real users.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Adding Dedicated Project Pages&lt;/strong&gt;&lt;br&gt;
Originally my portfolio just showed project cards. Now when you click a project, it opens a detailed page explaining the project — including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;why it was built&lt;/li&gt;
&lt;li&gt;what technologies were used&lt;/li&gt;
&lt;li&gt;what problems came up during development&lt;/li&gt;
&lt;li&gt;how those problems were solved&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I think projects become much more meaningful when you can see the thinking behind them, not just screenshots.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why I Treated It Like a Real Project&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Even though it’s “just a portfolio”, it’s still a reflection of how you build things.&lt;/p&gt;

&lt;p&gt;Things like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;structure&lt;/li&gt;
&lt;li&gt;performance&lt;/li&gt;
&lt;li&gt;deployment&lt;/li&gt;
&lt;li&gt;UX details&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are the same things that matter in real products.&lt;br&gt;
You Can Check It Out Here&lt;br&gt;
If you’re curious, you can see the portfolio here:&lt;br&gt;
👉 &lt;a href="https://mokshcodes.netlify.app" rel="noopener noreferrer"&gt;https://mokshcodes.netlify.app&lt;/a&gt;&lt;/p&gt;

</description>
      <category>performance</category>
      <category>react</category>
      <category>showdev</category>
      <category>webdev</category>
    </item>
    <item>
      <title>🚀 Understanding Strings and Characters in C</title>
      <dc:creator>Moksh Upadhyay</dc:creator>
      <pubDate>Sun, 09 Mar 2025 16:34:46 +0000</pubDate>
      <link>https://dev.to/moksh57/understanding-strings-and-characters-in-c-39ip</link>
      <guid>https://dev.to/moksh57/understanding-strings-and-characters-in-c-39ip</guid>
      <description>&lt;p&gt;In C programming, Strings and Characters are fundamental for handling text-based data. But did you know there’s a major difference between 'A' and "A" in C?&lt;/p&gt;

&lt;p&gt;✅ 'A' is a Character → Stored as a single byte in memory.&lt;br&gt;
✅ "A" is a String → Stored as two bytes (A + \0).&lt;/p&gt;

&lt;p&gt;💡 Memory Representation:&lt;/p&gt;

&lt;p&gt;'A' → Stored as ASCII value 65&lt;br&gt;
"A" → Stored as 65 + 0 (null character)&lt;br&gt;
Quick Tip 💡&lt;br&gt;
👉 Always use single quotes for characters ('A').&lt;br&gt;
👉 Use double quotes for strings ("Hello").&lt;br&gt;
👉 C strings always end with a null character (\0).&lt;/p&gt;

&lt;p&gt;🔥 Bonus: Want to master Strings in C? Check out my detailed blog where I covered:&lt;/p&gt;

&lt;p&gt;✅ String functions like strlen(), strcpy().&lt;br&gt;
✅ Pointer to String (the most powerful technique).&lt;br&gt;
✅ Detailed memory representation for both.&lt;br&gt;
👉 Read my full blog here: &lt;a href="https://mokshelearning.blogspot.com/2025/03/strings-and-characters-in-c-complete.html" rel="noopener noreferrer"&gt;Strings and Character in C&lt;/a&gt;&lt;/p&gt;

</description>
      <category>c</category>
      <category>programming</category>
      <category>pointer</category>
    </item>
    <item>
      <title>How to Swap Variables in C: A Simple Guide</title>
      <dc:creator>Moksh Upadhyay</dc:creator>
      <pubDate>Sun, 24 Nov 2024 09:33:47 +0000</pubDate>
      <link>https://dev.to/moksh57/how-to-swap-variables-in-c-a-simple-guide-2hii</link>
      <guid>https://dev.to/moksh57/how-to-swap-variables-in-c-a-simple-guide-2hii</guid>
      <description>&lt;p&gt;Swapping variables is a core concept in programming that comes in handy in many scenarios, such as sorting algorithms, data manipulation, or simply reversing values. If you're a beginner learning C programming, understanding how to swap two variables is essential to building your coding foundation.&lt;/p&gt;

&lt;p&gt;In C, swapping two variables can be done in a variety of ways. The most common and straightforward method involves using a temporary variable. This temporary variable holds the value of one of the variables while the other variable's value is assigned to the first. While this approach works well in many cases, it's important to note that C uses a call-by-value mechanism when passing variables to functions. This means changes made inside a function don’t reflect outside of it, which can sometimes confuse beginners.&lt;/p&gt;

&lt;p&gt;But fear not! If you want to ensure that the original values are modified, you can use pointers. Pointers allow you to directly access and modify the variables' memory locations, ensuring that the swap is reflected outside the function as well.&lt;/p&gt;

&lt;p&gt;There are other advanced techniques, such as swapping using arithmetic or XOR bitwise operations, which eliminate the need for a temporary variable. Each method has pros and cons, depending on the specific use case.&lt;/p&gt;

&lt;p&gt;If you want to learn how to implement swapping in C with detailed explanations, code examples, and the pros and cons of each method, be sure to head over to my &lt;a href="https://mokshelearning.blogspot.com" rel="noopener noreferrer"&gt;blog&lt;/a&gt;. I walk you through all the different ways to swap variables, ensuring you understand how each approach works and when to use it.&lt;/p&gt;

&lt;p&gt;Happy coding, and don’t forget to check out the full tutorial! 🚀&lt;/p&gt;

</description>
      <category>programming</category>
      <category>c</category>
    </item>
    <item>
      <title>Understanding Electricity Billing: A Comprehensive Guide</title>
      <dc:creator>Moksh Upadhyay</dc:creator>
      <pubDate>Fri, 12 Jul 2024 08:09:44 +0000</pubDate>
      <link>https://dev.to/moksh57/understanding-electricity-billing-a-comprehensive-guide-30jd</link>
      <guid>https://dev.to/moksh57/understanding-electricity-billing-a-comprehensive-guide-30jd</guid>
      <description>&lt;p&gt;Electricity billing is a crucial aspect of utility management, involving the calculation of costs based on the amount of electricity consumed by users. This process is essential for both residential consumers and businesses, ensuring accurate invoicing and financial management. In this guide, we'll explore the fundamental principles behind electricity billing systems.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How Electricity Billing Works&lt;/strong&gt;&lt;br&gt;
Electricity billing typically involves several key components:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Measurement of Electricity Consumption:&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Electricity usage is measured in units of kilowatt-hours (kWh). The more electricity consumed, the higher the bill.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Tariffs and Pricing Structures:&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Tariffs determine the cost per unit of electricity consumed. These tariffs may vary based on factors such as time of day (e.g., peak vs. off-peak hours) and total consumption levels.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Calculation of Charges:&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once the consumption in kWh is recorded, charges are calculated based on the applicable tariff rates. Additional charges, such as taxes or surcharges, may also apply.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Billing Cycles and Invoicing:&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Utility companies typically issue bills periodically (e.g., monthly) to customers based on their consumption during a specific billing cycle. Bills detail the amount of electricity consumed, applicable charges, and payment due dates.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Factors Affecting Electricity Bills&lt;/strong&gt;&lt;br&gt;
Several factors can influence the amount of an electricity bill:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Consumption Levels: Higher electricity consumption results in higher bills.&lt;/li&gt;
&lt;li&gt;Tariff Structures: Different tariffs can significantly impact the cost per unit of electricity consumed.&lt;/li&gt;
&lt;li&gt;Seasonal Variations: Electricity usage may fluctuate based on seasonal factors such as heating or cooling needs.&lt;/li&gt;
&lt;li&gt;Energy Efficiency: Adopting energy-efficient practices and technologies can help reduce overall consumption and lower bills.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Understanding Your Electricity Bill&lt;/strong&gt;&lt;br&gt;
To interpret your electricity bill accurately, it's essential to understand the breakdown of charges and the terms used:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Unit Price: The cost per kWh of electricity consumed.&lt;/li&gt;
&lt;li&gt;Fixed Charges: Base fees or minimum charges applied regardless of consumption.&lt;/li&gt;
&lt;li&gt;Taxes and Surcharges: Additional fees imposed by regulatory authorities or utility providers.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
Understanding electricity billing is crucial for consumers and businesses to manage energy consumption effectively and budget accordingly. By grasping the principles of how electricity bills are calculated, you can make informed decisions to optimize energy usage and reduce costs.&lt;/p&gt;

&lt;p&gt;For further insights into utility management and related topics, continue exploring resources that deepen your understanding of energy economics and sustainability.&lt;/p&gt;

&lt;p&gt;Read More: &lt;a href="https://gplinks.co/PHddXjZF" rel="noopener noreferrer"&gt;https://gplinks.co/PHddXjZF&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Building a Sleek C++ Calculator: Harnessing the Power of Modular Functions</title>
      <dc:creator>Moksh Upadhyay</dc:creator>
      <pubDate>Sat, 06 Jul 2024 12:30:51 +0000</pubDate>
      <link>https://dev.to/moksh57/building-a-sleek-c-calculator-harnessing-the-power-of-modular-functions-25ib</link>
      <guid>https://dev.to/moksh57/building-a-sleek-c-calculator-harnessing-the-power-of-modular-functions-25ib</guid>
      <description>&lt;p&gt;In the world of programming, creating practical applications that demonstrate elegance and efficiency is a testament to skillful craftsmanship. One such project that exemplifies this is building a calculator using C++ and modular functions. In this blog post, we'll explore the journey of constructing a functional calculator from scratch, focusing on the principles of modular programming.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Build a Calculator?&lt;/strong&gt;&lt;br&gt;
While a calculator may seem like a simple tool, its construction offers valuable insights into fundamental programming concepts such as functions, control flow, and data handling. By building a calculator, we not only practice these concepts but also learn how to structure our code in a modular and reusable manner—a cornerstone of software engineering.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Getting Started: Preparation and Environment Setup&lt;/strong&gt;&lt;br&gt;
Before diving into the implementation, it's essential to set up your C++ development environment. Choose an IDE or text editor with a C++ compiler that suits your preferences. This ensures a smooth development process and efficient coding workflow.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step-by-Step Guide to Building the Calculator&lt;/strong&gt;&lt;br&gt;
Designing the Functionality: Begin by outlining the basic functionalities your calculator will support. This typically includes arithmetic operations such as addition, subtraction, multiplication, and division. Plan how users will interact with the calculator through a simple user interface.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Implementing Modular Functions:&lt;/strong&gt; Modular programming involves breaking down complex tasks into smaller, independent modules or functions. Create separate functions for each arithmetic operation to maintain clarity and reusability in your code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Handling User Input and Output:&lt;/strong&gt; Develop mechanisms to receive user input for numbers and operation selection. Use conditional statements (if-else or switch-case) to direct the program flow based on user choices. Ensure robust error handling to manage unexpected inputs effectively.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Testing and Validation:&lt;/strong&gt; Once the core functionalities are implemented, rigorously test the calculator to ensure accuracy and reliability. Verify edge cases such as division by zero or non-numeric inputs. Debug any issues to achieve a stable and user-friendly application.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
Building a C++ calculator using modular functions not only enhances your programming skills but also reinforces essential software development principles. By organizing code into reusable modules, you promote maintainable and scalable application development practices.&lt;/p&gt;

&lt;p&gt;Ready to embark on this coding journey? Explore further by implementing additional features or refining the calculator's UI to expand its functionality and usability.&lt;/p&gt;

&lt;p&gt;Read more:&lt;br&gt;
&lt;a href="https://mokshelearning.blogspot.com/2024/07/Build-a-Sleek-Calculator-with-Modular-Functions.html" rel="noopener noreferrer"&gt;https://mokshelearning.blogspot.com/2024/07/Build-a-Sleek-Calculator-with-Modular-Functions.html&lt;/a&gt;]&lt;/p&gt;

</description>
      <category>cpp</category>
      <category>programming</category>
    </item>
    <item>
      <title>Finding Numbers Divisible by 3 and 5</title>
      <dc:creator>Moksh Upadhyay</dc:creator>
      <pubDate>Wed, 03 Jul 2024 13:32:11 +0000</pubDate>
      <link>https://dev.to/moksh57/finding-numbers-divisible-by-3-and-5-30cb</link>
      <guid>https://dev.to/moksh57/finding-numbers-divisible-by-3-and-5-30cb</guid>
      <description>&lt;p&gt;Hey Dev Community!&lt;/p&gt;

&lt;p&gt;Are you diving into C programming and looking for a hands-on exercise to sharpen your skills? I've just published a new blog post where I walk you through writing a simple C program to find numbers between 1 and 50 that are divisible by both 3 and 5. This exercise is perfect for beginners aiming to understand loops and conditional statements in C.&lt;/p&gt;

&lt;p&gt;In the blog, I cover:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Setting up a for loop to iterate through numbers&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Using conditional statements to check for divisibility&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Printing the results and counting the qualifying numbers&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Check out the full blog &lt;a href="https://mokshelearning.blogspot.com/2024/07/19-program-1-To-50-DivisibleBy-3-and-5.html" rel="noopener noreferrer"&gt;here&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;I'd love to hear your feedback and any questions you may have. Let's learn and code together! 💻🎉&lt;/p&gt;

</description>
      <category>c</category>
      <category>programming</category>
    </item>
    <item>
      <title>Unveiling the Fibonacci Sequence in C Programming</title>
      <dc:creator>Moksh Upadhyay</dc:creator>
      <pubDate>Tue, 02 Jul 2024 17:05:29 +0000</pubDate>
      <link>https://dev.to/moksh57/unveiling-the-fibonacci-sequence-in-c-programming-218p</link>
      <guid>https://dev.to/moksh57/unveiling-the-fibonacci-sequence-in-c-programming-218p</guid>
      <description>&lt;p&gt;𝐖𝐡𝐚𝐭 𝐢𝐬 𝐭𝐡𝐞 𝐅𝐢𝐛𝐨𝐧𝐚𝐜𝐜𝐢 𝐒𝐞𝐫𝐢𝐞𝐬?&lt;br&gt;
The Fibonacci series is a sequence of numbers where each number is the sum of the two preceding ones. It starts from 0 and 1, and the series looks something like this:&lt;br&gt;
0,1,1,2,3,5,8,13,21,34,…&lt;/p&gt;

&lt;p&gt;𝐖𝐡𝐲 𝐢𝐬 𝐢𝐭 𝐈𝐦𝐩𝐨𝐫𝐭𝐚𝐧𝐭?&lt;br&gt;
The Fibonacci series transcends its mathematical roots, manifesting in various natural phenomena and human creations. From the spiral patterns of galaxies to the arrangement of petals in flowers and the proportions of ancient architecture, the Fibonacci sequence embodies a universal pattern recognized across disciplines. In art, its rhythmic progression and harmonious proportions have inspired countless works. In computer science and algorithms, Fibonacci numbers serve as a foundation for efficient problem-solving techniques, from dynamic programming to optimizing recursive functions.&lt;/p&gt;

&lt;p&gt;Understanding and generating the Fibonacci series not only deepen one's grasp of mathematical concepts but also nurtures an appreciation for the intricate patterns woven into our world. It encourages creativity in problem-solving and fosters a deeper connection between mathematics and its practical applications.&lt;/p&gt;

&lt;p&gt;Read More: &lt;a href="https://mokshelearning.blogspot.com/2024/07/18-Program-FibonacciSeries.html" rel="noopener noreferrer"&gt;https://mokshelearning.blogspot.com/2024/07/18-Program-FibonacciSeries.html&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>🚀 Mastering Loop Control in C Programming: Leveraging break and continue 🌟</title>
      <dc:creator>Moksh Upadhyay</dc:creator>
      <pubDate>Tue, 02 Jul 2024 05:34:02 +0000</pubDate>
      <link>https://dev.to/moksh57/mastering-loop-control-in-c-programming-leveraging-break-and-continue-1116</link>
      <guid>https://dev.to/moksh57/mastering-loop-control-in-c-programming-leveraging-break-and-continue-1116</guid>
      <description>&lt;p&gt;Hey Dev Community! Are you ready to enhance your C programming skills and optimize your code? Today, let's delve into the powerful world of loop control with break and continue statements.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Understanding break and continue&lt;/strong&gt;&lt;br&gt;
In C programming, break and continue are essential tools for managing loops effectively:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;break:&lt;/strong&gt; This statement allows you to exit a loop prematurely based on a specified condition. It's perfect for terminating loops early when certain criteria are met, ensuring efficient program execution.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;continue:&lt;/strong&gt; Unlike break, continue skips the current iteration of the loop and proceeds directly to the next iteration. This helps in bypassing specific iterations without exiting the loop entirely, enabling selective processing of loop iterations.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Practical Applications&lt;/strong&gt;&lt;br&gt;
Here’s how you can apply a break and continue in your code:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Input Validation:&lt;/strong&gt; Use a break to stop processing input when an invalid value is encountered, preventing further unnecessary iterations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Error Handling:&lt;/strong&gt; Employ continue to skip over error-prone iterations while continuing to process valid data within the loop, enhancing program robustness and stability.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Benefits of Using Break and Continue&lt;/strong&gt;&lt;br&gt;
Mastering these loop control statements offers several advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Enhanced Code Efficiency:&lt;/strong&gt;&lt;br&gt;
Exit loops early or skip unnecessary iterations to optimize program performance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Improved Code Readability:&lt;/strong&gt; Clearly define loop termination conditions and iteration skips, making code logic more transparent and maintainable.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
Incorporating break and continue statements into your C programming toolkit empowers you to write cleaner, more efficient code. Whether you’re validating input, implementing search algorithms, or handling error conditions, these tools enhance your ability to control loop behavior effectively.&lt;/p&gt;

&lt;p&gt;Ready to elevate your programming skills? Dive into my detailed blog post on mastering loop control with break and continue: &lt;a href="https://mokshelearning.blogspot.com/2024/07/programn%20to%20show%20the%20usage%20of%20break%20and%20continue.html" rel="noopener noreferrer"&gt;https://mokshelearning.blogspot.com/2024/07/programn%20to%20show%20the%20usage%20of%20break%20and%20continue.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Master these fundamental tools and unlock new levels of efficiency and precision in your coding journey!&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
