why the program is not terminating in gcc? [closed]

This program will terminate just fine when the conditions are met. If you are on Linux press CTRL-D which is the EOF input. This will satisfy the condition and end the while loop.

while((c = getchar()) != EOF)
    putchar(c);

This function will run forever, keeping your program from terminating until it gets a EOF input. Check how to send EOF on your native system. Once you input that the program will terminate.

Browse More Popular Posts

Leave a Comment