Code:#include<stdio.h> int main() { int i; i=(getchar()!=EOF); printf("%3d",i); return 0; } when will this program print 0??????? i am not getting the output as 0 even when i've entered -1.....??????
Code:#include<stdio.h> int main() { int i; i=(getchar()!=EOF); printf("%3d",i); return 0; } when will this program print 0??????? i am not getting the output as 0 even when i've entered -1.....??????
You haven't entered an EOF character yet, I guess. Is it ^C? I don't know if you can even key that in in Windows. EOF is normally a file condition.
Here is a similar answer:
Keyboard stroke for EOF ? - C / C++ answers
it is ctrl+D
Ah, ctrl D, EOT (end-of-transmission). Thanks. I learn too.