down
david wald
wald-david at CS.YALE.EDU
Tue Dec 13 07:09:46 AEST 1988
In article <9142 at smoke.BRL.MIL> gwyn at brl.arpa (Doug Gwyn (VLD/VMB) <gwyn>) writes:
>In article <gables.352 at umigw.miami.edu> slores%gables.span at umigw.miami.edu (Stanislaw L. Olejniczak) writes:
>> while ( (c = getchar) != EOF)
>> chcnt++ += (c == '\n');
...
>The final problem is that you say c is a char. In that case it can
>never compare equal to EOF on many systems. getchar() returns an int,
>not a char.
Doesn't the expression (c = getchar()) have type (int) regardless of the
type of c? Or will c being a char really prevent this comparison?
============================================================================
David Wald wald-david at yale.UUCP
waldave at yalevm.bitnet
============================================================================
More information about the Comp.lang.c
mailing list