char ch;
while((ch=getc(stdin))!=EOF)
{
putc(ch,stdout);
}
As we know that EOF character can be inputted by ctrl-z
.
I ran the program two times:-
1- When I input ctrl-z
, the loop gets terminated, which is acceptable.
2- When I input ctrl-z
along with some other text like demo
and then press ctrl-z
, then the loop does not get terminated.
So my question is that why the loop is getting terminated only by inputing ctrl-z
alone?