title: global definition of a variable in C
body: <p>In simple terms global variables are variables that are declared or defined outside main() and has scope from the point of definition to the end of the program. </p>
  
  <p>I have a few questions on global variables. I am using GCC compiler.</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  int a,b;
  a=b=1;
  main()
  {
       printf("%d\n%d",a,b);
  }
  </code></pre>
  
  <p>This program generates error while </p>
  
  <pre><code>#include&lt;stdio.h&gt;
  int a,b;
  
  main()
  {
       a=b=1;
       printf("%d\n%d",a,b);
  }
  </code></pre>
  
  <p>generates the correct output.Why a=b=1 is not supported when used globally?</p>
  
  <p>I have one more question to ask.</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  a=1;
  b=9;
  c='c';
  h='h';
  
  main()
  {
      printf("%d\n%d\n",a,b);
      printf("%c\t%c\n",c,h);
  
  }
  </code></pre>
  
  <p>produces the correct result with warning that data definition has no type or storage class.  I am totally confused with global variables. </p>