++ -- Operator precedence puzzle
<p>For the long time I thought I get it, and I was going to create some puzzles to learn some of my „students“ on the topic of operator precedence in c#.
But it came out that I still don't get it right. </p>

<p>Puzzles:
What’s the output here?</p>

<pre><code>int a = 0;            
int x = --a + a++;
Console.WriteLine(x);
Console.WriteLine(a);
</code></pre>

<p>Output: </p>

<p>-2
0</p>

<p>All clear here, I expected this</p>

<p>Next, the problem one:</p>

<pre><code>int b = 0;
int y = b-- + b++;
Console.WriteLine(y);
Console.WriteLine(b);
</code></pre>

<p>Output:</p>

<p>-1
0</p>

<p>Well, here I also expected y to be -2… Now I’m trying to apply operator precedence rules and order of evaluation, and not sure I explained it to myself.
Read <a href="http://stackoverflow.com/questions/3346450/what-is-the-difference-between-i-and-i/3346729#3346729">this post</a> again few times today, but still don’t quite get it why is the result here -1?
Can someone help with how is the second result evaluated. why and how is it different than the first one? </p>
