title: Why can't we define function inside the main function?
body: <p>In the following program, I try to call the function <code>n()</code> and inside <code>n()</code>, try to call <code>m()</code> function which is defined in the <code>main</code> function, but when I compile, I get the error below:</p>
  
  <blockquote>
  <pre><code>In function `n':
  (.text+0xa): undefined reference to `m'
  error: ld returned 1 exit status
  </code></pre>
  </blockquote>
  
  <p>Why do I get an error? Please explain.</p>
  
  <p>The code is here:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  void m();
  void n()
  {
      m();
  }
  
  void main()
  {
      n();
      void m()
      {
          printf("hi");
      }
  }
  </code></pre>