x = -1
y= x++ + ++x
operands are always evaluated from left to right
before an operation is performed all the operands are
evaluated except in conditional operators such as (&& , || and in some cases of ?
then the operation is performed based on precedence
ans associativity.
before addition could be performed both the operand has to be
evaluated
Left operand
x++ is evaluated . since it is postfix expression the vlaue of the expression is the value of x before
the increment is performed. so the expression will get the value -1(which is the value of x before increment) but x will be incremented by one
so x will be -1+1=0.
Right operand
++x is evaluated . since it is prefixx expression the value of the expression is the value of x after
the increment is performed. so the expression will get the incremented value of x that is 1.
Left expression + Right expression
-1 + 1 = 0
so y=0
x =1
hope this helps
Saravanakumar R