[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: i = i++

> The outcome is not predictable, as EVERY compiler is free to implement it
as it wishes.
> Essentially, K&R advises to avoid such statements with side effects. It is
_NOT_ a good programming
> practice at all.
> People administering C language tests should avoid asking such questions,
as they make no sense. ;-)
believe it or not.... i got such a question in my final year college
practical exam viva... the examiner asked me the output of this program ..
and he thought that he was real smart....

#include <stdio.h>
int main(void);

int main(void)
    if (i++ == ++i)

btw: this program outputs A under vc++ 6.0, and B under egcs-2.91.66
compiled as cpp or c!!!