op precedence in C
utzoo!decvax!harpo!npoiv!alice!rabbit!ark
utzoo!decvax!harpo!npoiv!alice!rabbit!ark
Mon Oct 25 16:53:01 AEST 1982
It may be that
c = getchar();
if (c & 0177 == '\004')
should mask the parity bit off the character and then compare
it with a ctrl-d, but in fact it doesn't because & is lower
precedence than == . You need to write
if ((c & 0177) == '\004')
On the other hand, you can test if y is between x and z by saying
if (x <= y & y <= z)
and it will work! Of course
if (x <= y && y <= z)
is better (by almost any reasonable measure).
More information about the Comp.lang.c
mailing list