Solution: In C, getc() returns EOF when the end of a file is reached. getc() also returns EOF when it fails to do a specific operation. Hence, option c is the correct answer.
What does getc () return EOF?
In C/C++, getc() returns EOF when end of file is reached. getc() also returns EOF when it fails. ... To solve this problem, C provides feof() which returns non-zero value only if end of file has reached, otherwise it returns 0.
What does EOF return in C?
3 Answers. EOF indicates "end of file". A newline (which is what happens when you press enter) isn't the end of a file, it's the end of a line, so a newline doesn't terminate this loop.