It's probably so you can do this:Why I didn't think of this before, I don't know...Code:
if ((i = fgetc(stdin)) < 0) /* error */
I reasoned that since EOF is negative and the normal return values of fgetc() are non-negative in a range almost definitely smaller than int, there can be no conflict between them. I did not state that to avoid such a conflict, EOF was defined to be negative (though this may indeed have been an intention of whoever designed this part of the standard library).Quote:
Originally Posted by robwhit
Oh ok, I see now.
Sorry for the trouble. :)