Re: I have a problem in my study



Herbert Rosenau said:

<snip>

Hey, the OP had declared c as int - and getc() does not return char
but int.

Yes, but I think you'll find he was talking about how to indicate
end-of-file from a keyboard.

Read your book what getc returns - an char wided to int or
EOF.

s/char/unsigned char/

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
.



Relevant Pages

  • Re: casting to unsigned char for is*() and to*() functions
    ... > If `c' is an `int' obtained from something like getc(), ... I think the point is that getc and friends do not return a char, ... they all return an int. ... special effort. ...
    (comp.lang.c)
  • Re: Problem with printing input.
    ... >Hey you ... >int main ... Consider using putchar. ... are you counting in a char instead of an int. ...
    (comp.lang.c)
  • Re: I have a problem in my study
    ... the OP had declared c as int - and getc() does not return char but int. ... Read your book what getc returns - an char wided to int or EOF. ...
    (comp.lang.c)
  • Re: casting to unsigned char for is*() and to*() functions
    ... - `char' had been unsigned from the git-go. ... - getc() and co. had not been designed to cater to the ... `char' to `int'. ... you'd get character values with a lot of high-order sign bits ...
    (comp.lang.c)
  • Re: Detecting EOF
    ... Hey, hey hey! ... int temparr; ... EOF is not necessarily in the range of char. ...
    (comp.lang.c)