Well, It depends on the compiler you are using.

This code with multiple increments and decrements in one expression,
is *invalid* code per ISO 14882:2003 paragraph 5.4, As with any
invalid code, the compilers can do print any value, if they choose to
let this compile.
It's also invalid C per ISO 9899:1999 paragraph 6.5.2.

For Ex:

x = 2;

y = x++ + ++x + ++x + x++ +++x;

Answer may be:

Compiler                                                            y
gcc 4.4.3 on Linux produces                                19
Sun C++ 5.8 on Solaris for sparc produces           28
C compiler on Unix 7 for PDP-11 produces           25

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to