I think getch() is the most primitive input function of C, on which
getchar(),etc. are based. What may be happening is that getchar() uses getch() to take input, and keeps buffering it till getch() returns 26 (ascii for ctrl+z, which indicates the end of input in Windows) is encountered. It now senses that its the end of input and returns EOF.