title: Why is the .bss segment required?
body: <p>What I know is that global and static variables are stored in the <code>.data</code> segment, and uninitialized data are in the <code>.bss</code> segment. What I don't understand is why do we have dedicated segment for uninitialized variables?  If an uninitialised variable has a value assigned at run time, does the variable exist still in the <code>.bss</code> segment only?</p>
  
  <p>In the following program,  <code>a</code> is in the <code>.data</code> segment, and <code>b</code> is in the <code>.bss</code> segment; is that correct? Kindly correct me if my understanding is wrong.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  int a[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9};
  int b[20]; /* Uninitialized, so in the .bss and will not occupy space for 20 * sizeof (int) */
  
  int main ()
  {
     ;
  }  
  </code></pre>
  
  <p>Also, consider following program, </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  int var[10];  /* Uninitialized so in .bss */
  int main ()
  {
     var[0] = 20  /* **Initialized, where this 'var' will be ?** */
  }
  </code></pre>