title: how does the function return in c++ work
body: <p>I want to know how the compiler save this temporary int if I call the function f(3);
   </p>
  
  <pre><code>int f (int x) { return x; } 
  </code></pre>
  
  <p>and how this will be excuted by the compiler :</p>
  
  <pre><code>int a=f(3);
  </code></pre>
  
  <p>is it just like doing int a=x; (I know x will be already destroyed ) or it really create a temporary variable called f(3), like this <code>int f(3)=x;</code></p>
  
  <pre><code>int&amp; a=f(3);
  </code></pre>
  
  <p>and why this wont work ?</p>