title: Compound operation evaluation in C++
body: <p>When I execute the following code</p>
  
  <pre><code>#include &lt;iostream&gt;
  int &amp; f(int &amp;i)
  {
      puts("this is f");
      return ++i;
  }
  
  int main()
  {
      int x = 5;
      printf("%d", f(x) = f(x) + 1);
      return 0;
  }
  </code></pre>
  
  <p>I get output as 8. I am unable to understand how that's happening. Can anyone give me a reason for that?</p>