<?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: hassaan-syed</title>
    <description>The latest articles on DEV Community by hassaan-syed (@hassaansyed).</description>
    <link>https://dev.to/hassaansyed</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%2F3755233%2F6f3c69b0-4d26-4546-b5c8-5d5326269be5.png</url>
      <title>DEV Community: hassaan-syed</title>
      <link>https://dev.to/hassaansyed</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hassaansyed"/>
    <language>en</language>
    <item>
      <title>do you know what exactly startup code does ?</title>
      <dc:creator>hassaan-syed</dc:creator>
      <pubDate>Fri, 26 Jun 2026 17:03:21 +0000</pubDate>
      <link>https://dev.to/hassaansyed/do-you-know-what-exactly-startup-code-does--295k</link>
      <guid>https://dev.to/hassaansyed/do-you-know-what-exactly-startup-code-does--295k</guid>
      <description>&lt;p&gt;let me explain what happens before the main()&lt;/p&gt;

&lt;p&gt;Most C programmers believe that a program starts executing from the &lt;code&gt;main()&lt;/code&gt; function. Surprisingly, that is not true. Before &lt;code&gt;main()&lt;/code&gt; is ever called, another piece of code runs automatically. This hidden code is known as &lt;strong&gt;startup code&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Startup code is provided by the compiler and the C library(runtime). Although programmers never write it themselves, every C program depends on it. Its job is simple but essential—it prepares the program so that &lt;code&gt;main()&lt;/code&gt; can execute correctly.&lt;/p&gt;

&lt;p&gt;The first thing startup code does is initialize memory. It loads the values of initialized global and static variables into memory and clears the "_uninitialized variables by setting them to zero. _".This ensures that every global and static variable begins with the correct value.&lt;/p&gt;

&lt;p&gt;Next, startup code prepares the execution environment. It sets up the stack, initializes the runtime library, and, in operating systems like Linux and Windows, prepares the command-line arguments (&lt;code&gt;argc&lt;/code&gt; and &lt;code&gt;argv&lt;/code&gt;) that are passed to the &lt;code&gt;main()&lt;/code&gt; function.&lt;br&gt;
like:&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="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;argc&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;argv&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;"Number of arguments = %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;argc&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;i&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;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;argc&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&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;printf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"argv[%d] = %s&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;i&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;argv&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&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;Once everything is ready, startup code transfers control to &lt;code&gt;main()&lt;/code&gt;, where the programmer's code finally begins execution. When &lt;code&gt;main()&lt;/code&gt; finishes, startup code performs the final cleanup by calling the necessary &lt;strong&gt;exit routines&lt;/strong&gt; and returning the program's &lt;strong&gt;exit status&lt;/strong&gt;(collects the value and check either succseed or failed) to the operating system.&lt;/p&gt;

&lt;p&gt;The execution flow of a C program can be summarized as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Program Starts
      ↓
Startup Code
      ↓
Initialize Memory
      ↓
Setup Runtime Environment
      ↓
Call main()
      ↓
Cleanup and Exit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Although startup code remains invisible to most programmers, it is one of the most important parts of a C program. Without it, the program would not have a properly initialized memory or execution environment, making reliable execution impossible. Understanding startup code gives us a clearer picture of what really happens before our own code begins to run.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can We See the Source Code of Startup Code ?&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>c</category>
      <category>computerscience</category>
      <category>programming</category>
    </item>
    <item>
      <title>Why Your Computer Reads Numbers Backwards: Byte Order</title>
      <dc:creator>hassaan-syed</dc:creator>
      <pubDate>Sat, 16 May 2026 16:24:20 +0000</pubDate>
      <link>https://dev.to/hassaansyed/why-your-computer-reads-numbers-backwards-byte-order-explained-1hmg</link>
      <guid>https://dev.to/hassaansyed/why-your-computer-reads-numbers-backwards-byte-order-explained-1hmg</guid>
      <description>&lt;p&gt;&lt;strong&gt;What is Byte Order?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Before understanding byte order, we need to understand one thing:&lt;/p&gt;

&lt;p&gt;A byte = 8 bits&lt;/p&gt;

&lt;p&gt;Many data types use multiple bytes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;For example:

Data Type   Size
char           1 byte
short          2 bytes
int            4 bytes
long long      8 bytes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When a number takes multiple bytes, the computer has to decide:&lt;/p&gt;

&lt;p&gt;“In what order should I store these bytes in memory?”&lt;/p&gt;

&lt;p&gt;That storage order is called:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Byte Order (Endianness)&lt;/strong&gt;&lt;br&gt;
1.little order endian&lt;br&gt;
2.big order endian&lt;/p&gt;

&lt;p&gt;Most people assume memory stores it like this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;12 34 56 78&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;But here comes the surprise…&lt;/p&gt;

&lt;p&gt;On many computers, it is actually stored like this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;78 56 34 12&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Wait… what?&lt;/p&gt;

&lt;p&gt;Did the computer reverse the number?&lt;/p&gt;

&lt;p&gt;No. Your computer is not confused — this behavior is called Byte Order, also known as Endianness.&lt;/p&gt;

&lt;p&gt;In this article, we’ll understand byte order from scratch using diagrams, memory examples, and a practical C program.&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;Understanding With an Example&lt;br&gt;
*&lt;/em&gt;&lt;br&gt;
Let’s take this hexadecimal number:&lt;/p&gt;

&lt;p&gt;0x12345678&lt;/p&gt;

&lt;p&gt;This number contains 4 bytes:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;12    34    56    78&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now imagine memory locations like this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Address →   1000   1001   1002   1003&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The question is:&lt;/p&gt;

&lt;p&gt;Which byte should be placed first?&lt;/p&gt;

&lt;p&gt;This is where endianness comes in.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Type 1: Little Endian&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In Little Endian, the smallest byte (Least Significant Byte) comes first.&lt;/p&gt;

&lt;p&gt;Memory stores:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
Address →   1000   1001   1002   1003
Data    →    78      56      34      12
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;78 is stored first
12 is stored last
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This may look backward, but internally it helps processors perform arithmetic efficiently.&lt;/p&gt;

&lt;p&gt;Why is it called “&lt;em&gt;Little&lt;/em&gt;” Endian?&lt;/p&gt;

&lt;p&gt;Because the little end (least significant byte) is stored first.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Type 2: Big Endian&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In Big Endian, the largest byte (Most Significant Byte) comes first.&lt;/p&gt;

&lt;p&gt;Memory stores:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
Address →   1000   1001   1002   1003
Data    →    12      34      56      78
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This looks more natural because humans usually read numbers from left to right.&lt;/p&gt;

&lt;p&gt;Why is it called “&lt;em&gt;Big&lt;/em&gt;” Endian?&lt;/p&gt;

&lt;p&gt;Because the big end (most significant byte) comes first.&lt;/p&gt;

&lt;p&gt;Visual Comparison&lt;br&gt;
Number = 0x12345678&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
Little Endian
┌───────┬───────┬───────┬───────┐
│  78   │  56   │  34   │  12   │
└───────┴───────┴───────┴───────┘
 1000    1001    1002    1003


Big Endian
┌───────┬───────┬───────┬───────┐
│  12   │  34   │  56   │  78   │
└───────┴───────┴───────┴───────┘
 1000    1001    1002    1003
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;can I know why we want these endian orders ?&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>beginners</category>
      <category>computerscience</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Why 0.1 + 0.2 != 0.3 in C? Understanding Floating Point Numbers</title>
      <dc:creator>hassaan-syed</dc:creator>
      <pubDate>Sun, 05 Apr 2026 16:46:23 +0000</pubDate>
      <link>https://dev.to/hassaansyed/why-01-02-03-in-c-understanding-floating-point-numbers-2djm</link>
      <guid>https://dev.to/hassaansyed/why-01-02-03-in-c-understanding-floating-point-numbers-2djm</guid>
      <description>&lt;p&gt;HISTORY:IEEE 754 was invented in 1985 to standardize floating-point arithmetic, ensuring consistent, reliable, and portable numerical results across different computer hardware.&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;float&lt;/span&gt; &lt;span class="n"&gt;a&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="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;b&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="mi"&gt;2&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;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&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="mi"&gt;3&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;"Equal&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="k"&gt;else&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;"Not Equal&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="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;&lt;strong&gt;WHAT DO YOU EXPECT?&lt;/strong&gt;&lt;br&gt;
Eqaul or Not Equal,If Equal then your wrong because,&lt;br&gt;
computer dont know the . as a decimal so for that we usedb &lt;strong&gt;IEEE754 standard&lt;/strong&gt; for better uderstanding the real problem let us do by example.&lt;/p&gt;

&lt;p&gt;Computers don’t understand numbers like we do.&lt;br&gt;
We use decimal (base 10):&lt;br&gt;
0.1 → one tenth&lt;/p&gt;

&lt;p&gt;But computers use binary (base 2):&lt;br&gt;
0s and 1s only&lt;/p&gt;

&lt;p&gt;Now here’s the catch:&lt;br&gt;
Some decimal numbers cannot be represented exactly in binary&lt;/p&gt;

&lt;p&gt;Just like:&lt;br&gt;
1/3 = 0.3333... (infinite in decimal)&lt;/p&gt;

&lt;p&gt;Similarly:&lt;br&gt;
0.1 in binary = 0.0001100110011... (infinite)&lt;/p&gt;

&lt;p&gt;then,&lt;strong&gt;What is actaully stored in computer&lt;/strong&gt;&lt;br&gt;
like eg : float 0.1&lt;br&gt;
it stores the nearest approx value&lt;br&gt;
like : 0.10000000149011612 (in binary)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;WE CAN PROVE BY CODING&lt;/strong&gt;&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;float&lt;/span&gt; &lt;span class="n"&gt;a&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="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;b&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="mi"&gt;2&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;"%.20f&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;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;"%.20f&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;b&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;"%.20f&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;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&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;&lt;strong&gt;OUTPUT&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;0.10000000149011611938&lt;br&gt;
0.20000000298023223877&lt;br&gt;
0.30000001192092895508&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NOW,lets understand how really its stores in binary so called "Format"&lt;/strong&gt;&lt;br&gt;
its is simple its stores in 4bytes&lt;br&gt;
this bytes are divided into fixed paths we call as:&lt;br&gt;
1.sign&lt;br&gt;&lt;br&gt;
2.exponent&lt;br&gt;
3.mantisa&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%2F5463oys0ueouxdzm9r0k.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%2F5463oys0ueouxdzm9r0k.png" alt=" " width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;this are actaully important so keep in mind&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sign (S)&lt;/strong&gt;&lt;br&gt;
Decides whether the number is positive or negative&lt;br&gt;
Uses 1 bit only&lt;br&gt;
0 → Positive (+)&lt;br&gt;
1 → Negative (−)&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
+5.2 → Sign = 0&lt;br&gt;
-5.2 → Sign = 1&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Exponent (E)&lt;/strong&gt;&lt;br&gt;
Controls the scale (magnitude) of the number&lt;br&gt;
Think of it like moving the decimal point&lt;/p&gt;

&lt;p&gt;“How big or how small is the number?”&lt;br&gt;
Higher exponent → Bigger number&lt;br&gt;&lt;br&gt;
Lower exponent → Smaller number&lt;/p&gt;

&lt;p&gt;Example idea:&lt;br&gt;
1.23 × 10³ = 1230   (big)&lt;br&gt;
1.23 × 10⁻³ = 0.00123 (small)&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;In binary, the exponent does the same job.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Fraction / Mantissa (F)&lt;/strong&gt;&lt;br&gt;
Stores the actual digits (precision) of the number&lt;br&gt;
This is the main value part.&lt;/p&gt;

&lt;p&gt;“What are the exact digits of the number?”&lt;br&gt;
More fraction bits → More accuracy&lt;br&gt;&lt;br&gt;
Less fraction bits → Less accuracy&lt;/p&gt;

&lt;p&gt;let me ask something?&lt;br&gt;
do you know what is sign copy if yes comment please&lt;/p&gt;

&lt;p&gt;THANK YOU FOR READING &lt;br&gt;
"Take it from me that all knowledge is useless until it is connected with your life, because the purpose of knowledge is nothing but to show you the splendors of yourself!"&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>c</category>
      <category>computerscience</category>
      <category>programming</category>
    </item>
    <item>
      <title>What’s Inside Your .o File? A Beginner-Friendly Guide to the Linux nm Command</title>
      <dc:creator>hassaan-syed</dc:creator>
      <pubDate>Fri, 20 Feb 2026 05:51:13 +0000</pubDate>
      <link>https://dev.to/hassaansyed/whats-inside-your-o-file-a-beginner-friendly-guide-to-the-linux-nm-command-57i</link>
      <guid>https://dev.to/hassaansyed/whats-inside-your-o-file-a-beginner-friendly-guide-to-the-linux-nm-command-57i</guid>
      <description>&lt;p&gt;What Is the &lt;strong&gt;nm&lt;/strong&gt; Command?&lt;br&gt;
nm is a Linux command that shows the symbols from symbol table of an object file or executable.&lt;/p&gt;

&lt;p&gt;In simple words:&lt;br&gt;
nm tells you what functions and variables exist inside a compiled file.&lt;/p&gt;

&lt;p&gt;It is commonly used after compilation to inspect what got created inside the object file.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;nm file.o&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;what is &lt;strong&gt;symbol&lt;/strong&gt;?&lt;br&gt;
A symbol is simply a name that represents something in your program.A symbol in C programming is simply the name of a function or global variable that the compiler records inside a compiled file so that the linker and other parts of the system can identify and connect different pieces of code together&lt;/p&gt;

&lt;p&gt;That “&lt;em&gt;something&lt;/em&gt;” is usually:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A function&lt;/li&gt;
&lt;li&gt;A global variable&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Symbol table&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;| Symbol | Meaning       | Simple Explanation            |
| ------ | ------------- | ----------------------------- |
| T      | Text (global) | Global function               |
| t      | Text (local)  | Static function               |
| D      | Data (global) | Global initialized variable   |
| d      | Data (local)  | Static initialized variable   |
| B      | BSS (global)  | Global uninitialized variable |
| b      | BSS (local)   | Static uninitialized variable |
| U      | Undefined     | Used but defined elsewhere    |
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;each section meaning&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Text&lt;/strong&gt; (.text) → Stores functions (code)&lt;/li&gt;
&lt;li&gt;*&lt;em&gt;Data *&lt;/em&gt;(.data) → Stores initialized variables&lt;/li&gt;
&lt;li&gt;*&lt;em&gt;BSS *&lt;/em&gt;(.bss) → Stores uninitialized variables&lt;/li&gt;
&lt;li&gt;*&lt;em&gt;Undefined *&lt;/em&gt;(U) → Function exists, but defined somewhere else&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Memory Layout&lt;/strong&gt; :&lt;br&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%2Fpvvvg1aopebme2g8418g.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%2Fpvvvg1aopebme2g8418g.png" alt=" " width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;lets under stand by example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;

// Global variable
int global_var = 10;

// Static global variable
static int static_var = 20;

// Global function
void global_function() {
    printf("Inside global function\n");
}

// Static function
static void static_function() {
    printf("Inside static function\n");
}

int main() {
    global_function();
    static_function();
    return 0;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;compilation stages:&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;step 1&lt;/strong&gt; "compile into object file"&lt;br&gt;
&lt;code&gt;gcc -c file.c&lt;/code&gt;&lt;br&gt;
~This file.o is created&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;step 2&lt;/strong&gt; "nm command"&lt;br&gt;
&lt;code&gt;nm file.o&lt;/code&gt;&lt;br&gt;
~you can might see someting like this&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;OUTPUT:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;0000000000000000 T global_function&lt;br&gt;
0000000000000000 T main&lt;br&gt;
0000000000000000 t static_function&lt;br&gt;
0000000000000000 D global_var&lt;br&gt;
0000000000000000 d static_var&lt;br&gt;
                 U printf&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Important Note for Beginners&lt;/strong&gt;&lt;br&gt;
✔️ Global variables → become symbols&lt;br&gt;
✔️ Functions → become symbols&lt;br&gt;
❌ Local variables inside functions → usually NOT symbols&lt;br&gt;
ex:&lt;br&gt;
&lt;code&gt;void func() {&lt;br&gt;
    int x = 10;   // Not a symbol (local)&lt;br&gt;
}&lt;/code&gt;&lt;br&gt;
x is temporary and does not appear in nm.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;why local variable are not in output?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Local variables are not shown in nm because they are not needed for linking. The purpose of the symbol table (the one nm shows) is to help the linker connect different files together, and local variables do not participate in that process.Its exists only inside its function, lives temporarily on the stack segment&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>linux</category>
      <category>c</category>
      <category>systemsprogramming</category>
    </item>
    <item>
      <title>Understanding strlen() Internally by Writing It From Scratch in C</title>
      <dc:creator>hassaan-syed</dc:creator>
      <pubDate>Fri, 06 Feb 2026 07:04:42 +0000</pubDate>
      <link>https://dev.to/hassaansyed/understanding-strlen-internally-by-writing-it-from-scratch-in-c-2gj5</link>
      <guid>https://dev.to/hassaansyed/understanding-strlen-internally-by-writing-it-from-scratch-in-c-2gj5</guid>
      <description>&lt;p&gt;Let us understand the internal concept of &lt;strong&gt;&lt;code&gt;strlen()&lt;/code&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;strlen()&lt;/code&gt; is a predefined function which is used to know the length of a given string.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Syntax of strlen:&lt;/u&gt;&lt;br&gt;
strlen(variable_name);&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Example:&lt;/em&gt;&lt;br&gt;
char str[6] = "hello";   // here length = 5&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;char str[6] = "hello";
strlen(str);   // Output: 5

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

&lt;/div&gt;



&lt;p&gt;strlen(str);&lt;/p&gt;

&lt;p&gt;Firstly, what is a &lt;strong&gt;string&lt;/strong&gt;?&lt;/p&gt;

&lt;p&gt;In C, a string is not a data type.&lt;br&gt;
A string is a collection of characters which always ends with a special character '\0', also known as the null character.&lt;/p&gt;

&lt;p&gt;This null character indicates the end of the string.&lt;br&gt;
It does not mean “nothing in memory”, but it tells functions where the string stops.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Header file information:&lt;/strong&gt;&lt;br&gt;
There are some library files which include many function declarations to perform different tasks.&lt;br&gt;
Here, we are learning about the &lt;code&gt;strlen()&lt;/code&gt; function, which comes under the &lt;code&gt;&amp;lt;string.h&amp;gt;&lt;/code&gt; header file.&lt;/p&gt;

&lt;p&gt;Let us start from scratch — how strlen() works internally.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prototype of strlen:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int my_strlen(const char *str);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Explanation:&lt;br&gt;
int → return type (returns length of string)&lt;br&gt;
my_strlen → function name&lt;br&gt;
const char *str →&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;char * is a character pointer which stores the base address of the string&lt;/li&gt;
&lt;li&gt;const is used so that the value of the string cannot be modified inside the function (this helps avoid bugs)&lt;/li&gt;
&lt;li&gt;str is the variable name (kept meaningful and relatable)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;code:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int my_strlen(const char *str)
{
    int cnt = 0;
    while (str[cnt] != '\0')
    {
        cnt++;
    }
    return cnt;
}

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

&lt;/div&gt;



&lt;p&gt;We use a pointer to traverse the string from one character to another while counting.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How this works step by step:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When we pass the argument:&lt;br&gt;
my_strlen(str);&lt;br&gt;
-The base address of the string is passed to the function.&lt;/p&gt;

&lt;p&gt;Counter initialization:&lt;br&gt;
-Here, cnt is an integer variable used to count the number of characters in the string.&lt;/p&gt;

&lt;p&gt;While loop condition:&lt;br&gt;
-We know that every string ends with the null character '\0'.&lt;br&gt;
So the loop runs until '\0' is encountered.&lt;br&gt;
-Although we are using str[cnt], internally this works using pointer arithmetic.&lt;/p&gt;

&lt;p&gt;Incrementing the counter:&lt;br&gt;
-Each increment moves to the next character of the string and increases the count.&lt;/p&gt;

&lt;p&gt;Memory Representation:&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%2Fcgthghxn14sn42eexbfp.jpg" 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%2Fcgthghxn14sn42eexbfp.jpg" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Loop termination:&lt;/strong&gt;&lt;br&gt;
When str[cnt] becomes '\0':&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The condition becomes false&lt;/li&gt;
&lt;li&gt;The while loop terminates&lt;/li&gt;
&lt;li&gt;The function returns the value of cnt&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;THIS IS MY &lt;strong&gt;MY_STRING.H&lt;/strong&gt;(project)&lt;br&gt;
Full code on GitHub: &lt;a href="https://github.com/hassaan-syed/my_string.h" rel="noopener noreferrer"&gt;my_string.h&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Why does it return the length of the &lt;em&gt;string&lt;/em&gt;?&lt;/p&gt;

&lt;p&gt;Because:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Every character is counted&lt;/li&gt;
&lt;li&gt;The null character '\0' is not counted&lt;/li&gt;
&lt;li&gt;Counting stops exactly at the end of the string&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Final understanding:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;By writing strlen() from scratch, I understood:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How strings are stored in memory&lt;/li&gt;
&lt;li&gt;Why the null character is important&lt;/li&gt;
&lt;li&gt;How string traversal works internally in C&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>c</category>
      <category>beginners</category>
      <category>learning</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
