What is the result of i + ++i?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/949433/could-anyone-explain-these-undefined-behaviors-i-i-i-i-i-etc">Could anyone explain these undefined behaviors (i = i++ + ++i , i = i++, etc&hellip;)</a>  </p>
</blockquote>



<p>Why this code is generating 8 as a result ? </p>

<pre><code>#include &lt;iostream&gt; 
using namespace  std ;
void myFunction(int i)
{
    i = i + 2 + ++i;
    cout&lt;&lt;i&lt;&lt;endl;
}

void main () 
{
    int i = 2;
    myFunction(i);
    cin&gt;&gt; i;
}
</code></pre>

<p>I think the result should be 7 not 8...I am using Visual Studio 2008</p>
