Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!att!andante!alice!ark From: ark@alice.att.com (Andrew Koenig) Newsgroups: comp.lang.c Subject: Re: getchar and EOF (was: One more point regarding = and == (more flamage)) Message-ID: <20175@alice.att.com> Date: 7 Apr 91 17:25:08 GMT References: <3555@inews.intel.com> <3465@litchi.bbn.com> <1991Apr4.215605.2801@syssoft.com> <1991Apr7.064003.8552@athena.mit.edu> Reply-To: ark@alice.UUCP () Organization: AT&T Bell Laboratories, Liberty Corner NJ Lines: 16 In article <1991Apr7.064003.8552@athena.mit.edu> scs@adam.mit.edu writes: > getchar can return any char value, plus the single, "out of band" > value EOF [note 1]. Obviously, a variable of type char cannot > hold any-char-value-or-EOF, so getchar() is specified to return, > and any variable used to hold its return value must be declared > as, an int. Well, almost right. It returns a non-negative integer or EOF. If you are on a machine where chars are naturally signed, getchar will happily return values that are incapable of comparing equal to any char and are not EOF. -- --Andrew Koenig ark@europa.att.com