comma operator

Doug Gwyn gwyn at smoke.BRL.MIL
Tue Aug 15 05:47:33 AEST 1989


In article <2300 at oakhill.UUCP> stevenw at oakhill.UUCP (Steven Weintraub) writes:
>while ((ch = getchar()), ch != EOF && ch != '\n')
>Although I have never been quite satisfied with this, I have never found
>a structure that does this which I find more satisfying.

The usual idiom is

	while ( (ch = getchar()) != EOF && ch != '\n' )



More information about the Comp.lang.c mailing list