Ips wrote:
>
> hello!
>
> here's the code
> int main()
> {
> int i=0;
> printf("%d %d %d\n",i++,i++,i++);
>
> return 0;
> }
>
> can anybody explain how tthe arguments are passed to this function? Why does
> the output is : 3 2 1 and not 1 2 3 ?
> Is this ANSI compliant or only gcc compiles it like this?
In short:
It is undefined which output is right.
In long:
You modify a value more then once between sequence points. The result
of doing that is undefined.
This question (or variations of that) come up very often. Please use
google to search the newsgroup archive for a more indepth discussion.
--
Karl Heinz Buchegger