title: Scope of #define preprocessor in C
body: <p>The scope of <code>#define</code> is till the end of the file. But where does it start from.
  Basically I tried the following code.</p>
  
  <pre><code> #include&lt;stdio.h&gt;
   #include&lt;stdlib.h&gt;
   #define pi 3.14
   void fun();
   int main()
  {
   printf("%f \n",pi);
   #define pi 3.141516
      fun();
  return 0;
  }
  void fun(){
  printf("%f \n",pi);}
  </code></pre>
  
  <p>The output of the above program comes out to be</p>
  
  <pre><code>3.140000
  3.141416
  </code></pre>
  
  <p>Considering preprocessing for main the value of pi should be 3.141516
  and outside main 3.14. This is incorrect but please explain why.</p>