Q:

why the program is not terminating in gcc?

Why the program listed below is not terminating. I am using gcc compiler in linux.
#include <stdio.h>

int main(void)
{
    int c;

    printf("Enter characters: ");

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

    return 0;
}

A:

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.

