Am i evaluating the right way?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/4176328/undefined-behavior-and-sequence-points">Undefined Behavior and Sequence Points</a><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>This is a snippet :</p>

<pre><code>int a = 3;
int y = ++a-a++*a++/++a;
cout &lt;&lt; y &lt;&lt; endl;
int z = y++*a++;
cout &lt;&lt; z &lt;&lt; endl;
</code></pre>

<p>Upon compiling this the result is 0,0 and i too evaluated the same. But i may be evaluating the wrong way.
Here is what i did:</p>

<ol>
<li>starting from the left : ++a returns 4.</li>
<li>a++ returns 4 </li>
<li>4-4 = 0</li>
<li>0*(5/7) = 0</li>
</ol>

<p>If that is true,then the second evaluation is obvious ! </p>

<p>But have i evaluated the right way ?</p>

<p>I've used <strong>microsoft visual c++ 2010 express edition</strong> to compile this and get the same result everytime. Upon compiling the same in turbo c++ i get 5,35 respectively.!!</p>
