I\'m reading the book \"The C Programming Language\" and there is an exercise that asked to verify that the expression getchar() != EOF
is returning 1 or 0. Now
Here is my one,
i went through the same problem and same answer but i finally found what every body want to say.
System specification :: Ubuntu 14.04 lts
Software :: gcc
yes the value of EOF is -1 based on this statement
printf("%i",EOF);
but if your code contain like this statement
while((char c=getchar)!=EOF);;
and you are trying to end this loop using -1 value, it could not work.
But instead of -1 you press Ctrl+D your while loop will terminate and you will get your output.