C question
mwm at ucbtopaz.CC.Berkeley.ARPA
mwm at ucbtopaz.CC.Berkeley.ARPA
Wed Apr 10 07:43:41 AEST 1985
In article <5272 at tektronix.UUCP> paulh at tektronix.UUCP (Paul Hoefling) writes:
>An inexperienced C programmer wrote a program containing the following:
> x = x++;
>Assuming that x originally had the value 5, what should the value be after
>execution of the above expression ?
Either 5 or 6, depending on the phase of the moon and the mood of the
compiler. That expression, like such things as:
y = funct(x, x++) ;
y = &x ;
x = funct((*y)++) ;
and other, cuter problems, are indeterminate. If you want your code to
be portable, you don't use such things. C is just full of goodies like
this, but so are most other languages.
<mike
More information about the Comp.lang.c
mailing list