use of if (!cptr) and if (cptr) && a programming error
Doug Gwyn
gwyn at smoke.BRL.MIL
Wed Aug 2 07:19:36 AEST 1989
In article <10592 at riks.csl.sony.JUNET> diamond at riks. (Norman Diamond) writes:
>But! What about the following famous idiom!
> while ((ch = getchar()) != EOF) { ... }
>The old value of ch might be compared to EOF?
No -- however, EOF may be evaluated before ch is set to what getchar()
returns (before the comparison of the new value of ch against EOF).
More information about the Comp.lang.c
mailing list