title: Recursion in c++ Factorial Program
body: <p>hello i have this piece of code that i coded based on some other recursion and factorial programs
  but my problem is that i am really confused as to how it stored the value and kept it and then returned it at the end</p>
  
  <pre><code>int factorialfinder(int x)
  {
      if (x == 1)
      {
          return 1;
      }else
      {
          return x*factorialfinder(x-1);
      }
  }
  int main()
  {
    cout &lt;&lt; factorialfinder(5) &lt;&lt; endl;
  }
  </code></pre>
  
  <p>so 5 goes in, and gets multiplied by 4 by calling its function again and again and again, then it gets to one and it returns the factorial answer</p>
  
  <p>why? i have no idea how it got stored, why is return 1 returning the actual answer, what is it really doing?</p>