It was thus said that the Great Bryan Pope once stated:
And thusly Sean 'Captain Napalm' Conner spake:
And this is a perfect example of what I was trying to get across (and so
far, no one has stated the correct answer, yet both Bryan's and Mike's
compilers have produced a correct answer. To add fuel to the conversation,
the IRIX 4.0.5 C compiler would produce
0 0 0
which is also a correct answer.
Now I am going to have to find my K & R book... I believe it says that
the order for a printf it right to left and since the "++" is after the
variable, the increment gets done after the value of retrieved.
The order of evaluation of parameters to a function go right to left (due
that functions can received a variable number of arguments, and *most*
implementations pass parameters on the stack (used to save return addresses)
it makes things consistent if you go right to left and have the return
address always in the same place on the stack when a function is
called---did that make sense?), *but* the writeback of the post-increment
(x++) can be held until the end of a sequence point (or statement, it's been
a while since I knew the actual details, since I know better than to write
such code 8-).
Just one of the murkier points of C.
-spc (Also, bare 'char' declarations can be signed or unsigned)