Well, your code has no loop, so you'll always fall though to the "end."
Perhaps you meant
Code:
$ cat temp.c
#include<stdio.h>
main(){
int c,count=0;
while ((c=getchar()) != EOF)
printf("process c=\"%c\"\n",c);
printf("end\n");
}
$ echo -n abcd | ./temp
process c="a"
process c="b"
process c="c"
process c="d"
end
Note: ^C will terminate the execution of the whole program, not end the input. ^D is what you want.
Note2: The getchar function will read the '\n' at the end of each input line, hence the
-n option to the
echo command in the sample output, above.