title: Function calls that don't do anything in C++
body: <p>Why when I call the <code>factorial</code> function it doesn't do anything?</p>
  
  <p>Is this the right way to implement a factorial function?</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cmath&gt;
  
  using namespace std;
  
  int factorial(int n)
  {
      if (n &lt;= 1)
      {
          return 1;
      }
      else 
      {
         return n * factorial(n-1);
      }
   }
  
   int main()
   {
       int x = 3;
       cout &lt;&lt; x &lt;&lt; endl;
       factorial(x);
       cout &lt;&lt; x;
       return 0;
   }
  </code></pre>