A curriosity in the C compiler...
Gordon Cross
crossgl at ingr.UUCP
Tue Nov 1 03:30:25 AEST 1988
In article <530 at uvicctr.UUCP>, sbanner1 at uvicctr.UUCP (S. John Banner) writes:
>
> /*
> This is a quick test of the C compiler, for implied bracketing...
> This will determine if the expression "a = b == c" is parsed
> as "(a = b) == c" (which is correct), or as "a = (b == c)" (which
> is not).
> */
The correct treatment of the expression a = b == c is a = (b == c) and NOT
(a = b) == c!! Check your info on operator precedence. I believe that you
will discover that == has higher precedence than =.
Gordon Cross
Intergraph Corp. Huntsville, AL
More information about the Comp.lang.c
mailing list