title: initialized vs uninitialized global const variable in c
body: <p>Pardon me, I am not very good in explaining questions. So I start with example directly </p>
  
  <p>Look at following example</p>
  
  <pre><code>const int a=10;
  int *ptr;
  
  int main(){
      ptr=&amp;a; 
      *ptr=100;   // program crashes
      printf("%d",a);
  }
  </code></pre>
  
  <p>But If I made a slightly change in above code as following</p>
  
  <pre><code>const int a; // uninitialized global variable 
  </code></pre>
  
  <p>Then the above code works fine. </p>
  
  <p>So my question is why compiler behaves differently for uninitialize and initialize global const variables? </p>
  
  <p>I am using gcc for windows (mingw). </p>