I am pretty confused about the usage of EOF in the getchar() function.
Why the value of EOF is -1 and why the value of
getchar()!=EOF is 0.
Can anyone help me out of this?
You can see it like this :
getch()!=EOF will check for EOF, if EOF is reached, NOT of it is returned i.e. 0.
Imagine it as a Boolean expression, not the exact value. Just TRUE or FALSE.