Assuming that a, b and c are of integer type whose initial value is 0:
The result are as follows:
Now I am confused. It seems that in (2) a = b++ + c++;, the + gets evaluated first before the ++.
How is this so? From what I've read, ++ has a higher precedence over the + then the = comes last.
Same goes with (3) and (4).
Can someone explain to me the reason?
Thanks!
Zagato
Code:
(1) a = ++b + ++c;
(2) a = b++ + c++;
(3) a = ++b + c++;
(4) a = b-- + --c;
The result are as follows:
Code:
(1) 2
(2) 2
(3) 5
(4) 5
Now I am confused. It seems that in (2) a = b++ + c++;, the + gets evaluated first before the ++.
How is this so? From what I've read, ++ has a higher precedence over the + then the = comes last.
Same goes with (3) and (4).
Can someone explain to me the reason?
Thanks!
Zagato