title: function declaration inside main and also outside main in C
body: <p>The first program compiled properly.second gave error saying too few argument for foo...
  is global declaration ignored by the compiler in both programs?</p>
  
  <p><strong>first program:</strong></p>
  
  <pre><code>#include&lt;stdio.h&gt;
      void foo();
  int main()
  {
    void foo(int);
    foo(1);
    return 0;
  }
  
  void foo(int i)
  {
     printf("2 ");
  }
  
  void f()
  {
     foo(1);
  }
  </code></pre>
  
  <p><strong>second program:</strong></p>
  
  <pre><code>void foo();
  int main()
  {
    void foo(int);
    foo();
    return 0;
  }
  
  void foo()
  {
     printf("2 ");
  }
  
  void f()
  {
     foo();
  }
  </code></pre>