Hi,
I am currently studying K&R and I was looking at the example as follows:
I am a little confused about the EOF. I checked and I am pretty sure that my EOF is -1 but when I input -1 in this program, the program doesn't end. -1 is treated just like the other characters. Am I missing something?Code:#include <stdio.h>
main ()
{
int c;
c = getchar();
while (c != EOF)
{
putchar(c);
c = getchar();
}
}