tags:

views:

52

answers:

2
+4  A: 

All of your examples have undefined behaviour according to the C specification. Your compiler can give you whatever results it likes.

Carl Norum
+3  A: 

Can anyone please explain me this. and also any good reference for brushing up C?

Modifying an l-value more than once between adjacent sequence points (roughly equivalent to statements) is an undefined operation. Your compiler is permitted to return any answer (including crashing, throwing an exception, etc.) and it will be correct according to the standard.

As for a reference on brushing up, K&R's is still pretty good.

John Feminella
...without an intervening sequence point
Paul R