<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by bikesh tamang on Medium]]></title>
        <description><![CDATA[Stories by bikesh tamang on Medium]]></description>
        <link>https://medium.com/@bikesh_tamang?source=rss-4edbde01447d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*zv6aIaEZG80Dz6oH6TaaCw.jpeg</url>
            <title>Stories by bikesh tamang on Medium</title>
            <link>https://medium.com/@bikesh_tamang?source=rss-4edbde01447d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 06:15:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bikesh_tamang/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Article 2: Pointers in C Programming]]></title>
            <link>https://medium.com/@bikesh_tamang/article-2-pointers-in-c-programming-3592649229cd?source=rss-4edbde01447d------2</link>
            <guid isPermaLink="false">https://medium.com/p/3592649229cd</guid>
            <dc:creator><![CDATA[bikesh tamang]]></dc:creator>
            <pubDate>Mon, 09 Mar 2026 15:49:57 GMT</pubDate>
            <atom:updated>2026-03-09T16:00:44.081Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is a Pointer?</h3><p>In a standard C program, when you declare a variable like int x = 10;, the computer finds a small &quot;box&quot; in its memory (RAM), labels it x, and puts the number 10 inside.</p><p>A <strong>Pointer</strong> is a special variable that doesn’t hold a value like 10 or 50. Instead, it holds the <strong>memory address</strong> of another variable. It points to where that variable lives in the computer’s RAM.</p><h3>Why are Pointers Important?</h3><p>You might wonder, “Why not just use the variable name?” In small programs, you can. But as you build complex systems, pointers become essential for:</p><ol><li><strong>Dynamic Memory Allocation:</strong> Creating data structures like linked lists or trees that grow as the program runs.</li><li><strong>Efficiency:</strong> Instead of copying a massive dataset (like a high-res image) to a function, you just pass a pointer (the address) to it.</li><li><strong>Direct Hardware Access:</strong> Interacting directly with memory-mapped I/O in embedded systems.</li></ol><h3>The Secret Language: Syntax and Operators</h3><p>To work with pointers, you must master two specific symbols:</p><h4>1. The Address Operator (&amp;)</h4><p>This operator literally means “Address of.” If you have a variable num, writing &amp;num gives you the hexadecimal memory address where num is stored.</p><h4>2. The Dereference Operator (*)</h4><p>This operator has two roles. In a <strong>declaration</strong>, it tells C “this is a pointer.” In an <strong>expression</strong>, it means “Value pointed to by.”</p><p><strong>Declaration Syntax:</strong>data_type *pointer_name;<em>Example:</em> int *ptr; (This says: ptr is a variable that will hold the address of an integer.)</p><h3>A Simple Pointer Example</h3><p>Let’s see how these two operators play together in a real script.</p><pre>#include &lt;stdio.h&gt;<br><br>int main() {<br>    int age = 25;      // A regular variable<br>    int *ptr;          // A pointer declaration<br>    ptr = &amp;age;        // Storing the address of age in ptr<br>    printf(&quot;Value of age: %d\n&quot;, age);<br>    printf(&quot;Address of age: %p\n&quot;, &amp;age);<br>    printf(&quot;Value stored in ptr (address): %p\n&quot;, ptr);<br>    printf(&quot;Value pointed to by ptr: %d\n&quot;, *ptr); // Dereferencing<br>    return 0;<br>}</pre><p>In this code, *ptr acts like a remote control. By &quot;dereferencing&quot; the pointer, we can access or even change the value of age without ever touching the age variable directly.</p><h3>Pointers and Arrays: An Unbreakable Bond</h3><p>In C, the name of an array is actually a pointer to its first element. This is why pointers and arrays are often discussed together. When you write arr[i], the compiler internally treats it as *(arr + i).</p><pre>int numbers[3] = {10, 20, 30};<br>int *p = numbers; // No &#39;&amp;&#39; needed because &#39;numbers&#39; is already an address<br>printf(&quot;%d&quot;, *(p + 1)); // This will print 20 (the second element)</pre><h3>Functions: Pass by Reference</h3><p>By default, C uses “Pass by Value.” If you send a variable to a function, the function makes a copy. If the function changes that copy, the original stays the same.</p><p><strong>Pass by Reference</strong> uses pointers to allow a function to modify the original variable in the caller’s memory.</p><pre>void addFive(int *n) {<br>    *n = *n + 5; // Modifying the value at the address<br>}<br>int main() {<br>    int x = 10;<br>    addFive(&amp;x); // Sending the address<br>    printf(&quot;%d&quot;, x); // Output: 15<br>    return 0;<br>}</pre><h3>Common Mistakes: The “Danger Zone”</h3><p>Pointers give you great power, but they also give you the power to crash your computer. Here are the most common pitfalls:</p><ul><li><strong>Uninitialized Pointers (Wild Pointers):</strong> Creating a pointer but not giving it an address. It might point to a random, critical part of your operating system.</li><li><strong>Memory Leaks:</strong> Allocating memory but forgetting to “free” it, eventually slowing down the computer.</li><li><strong>Dereferencing NULL:</strong> Trying to access the “value” of a pointer that points to nothing (NULL). This usually results in a &quot;Segmentation Fault.&quot;</li></ul><h3>Conclusion</h3><p>Pointers are the difference between a “coder” and a “programmer.” They require you to think about how the computer actually works under the hood. While the syntax can be tricky at first — remembering when to use * and when to use &amp;—the ability to manipulate memory directly is what makes C one of the fastest and most enduring languages in history.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3592649229cd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Article 1: Functions in C Programming]]></title>
            <link>https://medium.com/@bikesh_tamang/article-1-functions-in-c-programming-cb72a48fac24?source=rss-4edbde01447d------2</link>
            <guid isPermaLink="false">https://medium.com/p/cb72a48fac24</guid>
            <dc:creator><![CDATA[bikesh tamang]]></dc:creator>
            <pubDate>Mon, 09 Mar 2026 15:45:18 GMT</pubDate>
            <atom:updated>2026-03-09T16:01:34.184Z</atom:updated>
            <content:encoded><![CDATA[<h3>What Exactly is a Function?</h3><p>A <strong>function</strong> is a self-contained block of code designed to perform a specific task. Think of it as a sub-program within your main program. You give it some data, it does its job, and it might give you a result back.</p><h4>Why Bother Using Them?</h4><p>If you’re writing a simple “Hello World,” you don’t need functions. But as soon as your projects grow, functions become your best friend for three reasons:</p><ol><li><strong>Reusability:</strong> Write code once, use it a thousand times.</li><li><strong>Organization:</strong> They break complex problems into smaller, manageable chunks (Modularization).</li><li><strong>Easier Debugging:</strong> If the “CalculateTax” part of your code is broken, you know exactly which function to check.</li></ol><h3>The Anatomy of a Function: Syntax and Structure</h3><p>To use a function in C, you need to understand three key stages: <strong>Declaration, Definition, and Call.</strong></p><h4>1. Function Declaration (The Prototype)</h4><p>This tells the compiler, “Hey, a function with this name and these requirements exists.” It usually goes above the main() function.</p><ul><li><strong>Syntax:</strong> return_type function_name(parameter_list);</li></ul><h4>2. Function Definition (The Meat)</h4><p>This is where the actual work happens. You write the logic inside curly braces.</p><ul><li><strong>Syntax:</strong></li></ul><pre>return_type function_name(parameter_list) {<br>    // Body of the function<br>    // Code to be executed<br>}</pre><h4>3. Function Call (The Action)</h4><p>The function won’t run by itself. You have to “call” it inside main() or another function.</p><ul><li><strong>Syntax:</strong> function_name(arguments);</li></ul><h3>The Two Worlds: Library vs. User-Defined Functions</h3><p>C provides two main “buckets” for functions:</p><ul><li><strong>Library Functions:</strong> These are built-in functions provided by C headers. You’ve likely used printf() and scanf() from &lt;stdio.h&gt; or sqrt() from &lt;math.h&gt;. You don&#39;t write these; you just use them.</li><li><strong>User-Defined Functions:</strong> These are the functions <em>you</em> create to solve your specific problems.</li></ul><h3>The Four Flavors of User-Defined Functions</h3><p>Depending on whether a function takes input (arguments) or gives back output (return values), we categorize them into four types:</p><h4>1. No Argument, No Return Value</h4><p>The function is totally independent. It doesn’t need data from the caller, and it doesn’t send anything back.</p><ul><li><em>Example:</em> A function that just prints a “Welcome” banner.</li></ul><h4>2. Argument, No Return Value</h4><p>You give the function some data to work with, but it handles the result itself (e.g., printing it) without sending a value back to main.</p><ul><li><em>Example:</em> printSum(5, 10); where the function prints &quot;15&quot; but doesn&#39;t return the number 15 to the program logic.</li></ul><h4>3. Argument with Return Value</h4><p>The most common type. You give it data, it processes it, and it “hands” the result back to you.</p><ul><li><em>Example:</em> A square root function where you pass 9 and it returns 3.</li></ul><h4>4. No Argument, but a Return Value</h4><p>The function doesn’t need input, but it generates a value to give back.</p><ul><li><em>Example:</em> A getSystemTime() function.</li></ul><h3>Seeing it in Action: A Simple Example</h3><p>Let’s look at a program that uses a function to find the area of a rectangle. We will use the <strong>Argument with Return Value</strong> style, as it’s the most professional approach.</p><pre>#include &lt;stdio.h&gt;<br>// 1. Function Declaration<br>int calculateArea(int length, int width);<br><br>int main() {<br>    int l, w, area;<br>    printf(&quot;Enter length and width: &quot;);<br>    scanf(&quot;%d %d&quot;, &amp;l, &amp;w);<br>    // 3. Function Call<br>    area = calculateArea(l, w); <br>    printf(&quot;The area is: %d\n&quot;, area);<br>    return 0;<br>}<br>// 2. Function Definition<br>int calculateArea(int length, int width) {<br>    int result = length * width;<br>    return result; // Returning the value to main<br>}</pre><h3>The Big Picture: Advantages</h3><p>Why is the effort of setting up functions worth it?</p><ul><li><strong>Memory Efficiency:</strong> Instead of repeating the same 20 lines of code 10 times (using 200 lines of memory), you write it once and call it 10 times.</li><li><strong>Abstraction:</strong> You don’t need to know <em>how</em> sqrt() works to use it. Functions allow you to hide the complexity of a task.</li><li><strong>Collaboration:</strong> In a professional setting, one developer can write the “Database” functions while another writes the “UI” functions without stepping on each other’s toes.</li></ul><h3>Conclusion</h3><p>Functions are the secret sauce of efficient programming. They transform a linear, repetitive script into a dynamic, organized system. By mastering the art of declaring, defining, and calling functions, you aren’t just writing code — you’re designing a system.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cb72a48fac24" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>