an example on c++ post increment operator
<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>Consider the following example on C++ post increment operator on ints:</p>

<pre><code>#include &lt;iostream&gt;
using namespace std;
int main() {
   int x=20;
   x = x++ + 10;
   cout &lt;&lt; x;
}
</code></pre>

<p>This returns 31. I was expecting 30 because x++ increments x but returns the previous value 20 and so 20+10=30 should get assigned to x. </p>
