title: How Does This Recursive Function Operate in C++?
body: <p>I'd like to know how the 2nd output in the following code example is produced. How is the function able to count backwards after the if statement and recursive function call have ended? </p>
  
  <pre><code>void Recursion(int x)
  {
      if(x &lt; 4) {
          cout &lt;&lt; x &lt;&lt; " "; // 1st output: 1 2 3
          Recursion(x + 1); 
      }
  
      cout &lt;&lt; x &lt;&lt; " "; // 2nd output: 4 3 2 1
  }
  
  int main()
  {
      Recursion(1);
  }
  </code></pre>