title: How do global variables contribute to the size of the executable?
body: <p>Does having global variables increase the size of the executable? If yes how? Does it increase only the data section size or also the text section size?</p>
  
  <p>If I have a global variable and initialization as below:</p>
  
  <pre><code>char g_glbarr[1024] = {"jhgdasdghaKJSDGksgJKASDGHKDGAJKsdghkajdgaDGKAjdghaJKSDGHAjksdghJKDG"};
  </code></pre>
  
  <p>Now, does this add 1024 to data section and the size of the initilization string to text section?</p>
  
  <p>If instead if allocating space for this array statically, if I malloc it, and then do a memcpy, only the data section size will reduce or the text section size also will reduce?</p>