title: Location of Uninitialized Data in an C
body: <p>I wanted to know that where will the uninitialized data be stored after it has been modified?</p>
  
  <p>For instance,</p>
  
  <p>all the variables which are initialized to some value in the code will be stored in the .data section.</p>
  
  <p>all the variables which are not initialized, will be initialized to 0 by the compiler and stored in the .bss section.</p>
  
  <p>Now, let's say, I define an array of 10 integers in the code. But I do not specify the elements of this array. So, all the integers of the array will be initialized to 0 by the compiler and 40 bytes will be reserved in the .bss section.</p>
  
  <p>After this, I write some data to the array, will it modify the data in .bss section itself?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;math.h&gt;
  
  int main(int argc, char **argv)
  {
      int i;
  
      /* 10 integers are initialized to 0 and stored in the .bss section */
  
      unsigned int numbers[10];
  
      /* write data to array */
  
      for(i=0;i&lt;10;i++)
      {
          numbers[i]=pow(2,i);
      }
  </code></pre>