title: Simulating nested functions in C++
body: <p>In C the following code works in gcc.</p>
  
  <pre><code>int foo( int foo_var )
  {
   /*code*/
    int bar( int bar_var )  
    {
      /*code*/
      return bar_var;
    }
    return bar(foo_var);
  }
  </code></pre>
  
  <p>How can I achieve the same functionality of nested functions in C++ with the gcc compiler? Don't mind if this seems like a beginner question. I am new to this site.</p>