title: declaring variables without any data type in c
body: <p>In this <code>c</code> program  </p>
  
  <pre><code>a=8;
  main()
  {
      printf("%d", a);
  }   
  </code></pre>
  
  <p>variable a has been declared without any data type and still this program compiles successfully and gives the desired output.<br>
  output :: </p>
  
  <pre><code>8  
  </code></pre>
  
  <p>see it on <a href="http://ideone.com/NioWM">ideone</a>.<br>
  but, when i declared the same variable inside main, it gives compilation error.   </p>
  
  <pre><code>main()
  {
       a=8;
      printf("%d", a);
  }  
  </code></pre>
  
  <p>output :: </p>
  
  <pre><code>prog.c:2: warning: return type defaults to ‘int’
  prog.c: In function ‘main’:
  prog.c:3: error: ‘a’ undeclared (first use in this function)
  prog.c:3: error: (Each undeclared identifier is reported only once
  prog.c:3: error: for each function it appears in.)
  prog.c:4: warning: implicit declaration of function ‘printf’
  prog.c:4: warning: incompatible implicit declaration of built-in function ‘printf’  
  </code></pre>
  
  <p>see <a href="http://ideone.com/2hILX">here</a>.</p>
  
  <p><strong>How the first program is working but the second?</strong></p>