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 */
Last edited by robwhit; 08-28-2008 at 03:52 PM.
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).Originally Posted by robwhit
Oh ok, I see now.
Sorry for the trouble.
Last edited by robwhit; 08-29-2008 at 10:22 AM.