Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!princeton!allegra!ulysses!sfmag!sfsup!mpl From: mpl@sfsup.UUCP Newsgroups: comp.lang.c Subject: Re: Writing readable code Message-ID: <1597@sfsup.UUCP> Date: Mon, 6-Jul-87 13:17:44 EDT Article-I.D.: sfsup.1597 Posted: Mon Jul 6 13:17:44 1987 Date-Received: Wed, 8-Jul-87 03:07:49 EDT References: <1158@copper.TEK.COM> <6858@auspyr.UUCP> <17171@cca.CCA.COM> <13112@topaz.rutgers.edu> Organization: AT&T-IS, Summit N.J. USA Lines: 19 Summary: WHAT? What's wrong with c? In article <13112@topaz.rutgers.edu>, ron@topaz.rutgers.edu.UUCP writes: > To do this right you need an extra int temporary value > > while ((i = getchar()) != EOF) > or > while( i = getchar(), i != EOF) > > followed by > c = i; Since when? WHat's wrong with: int c; while ((c = getchar()) != EOF) { /* use c as you would any char variable */ /* because char's are promoted to int ANYWAY */ /* in expressions - no need for a temp variable */ }