I am really a novice in C programming, this is a program from KnR2
It counts the number of characters in the input
#include<stdio.h>
main()
{
long nc;
nc=0;
while(getchar()!=EOF)
++nc;
printf("%ld\n",nc);
}
and here's the output-
RedDragon:~ test$ gcc chrcnt.c
RedDragon:~ test$ ./a.out
igsafkg
isgfg
so, as you can see I cannot get the print as the EOF is not getting encountered by the flow, how do I make this program work?? I use Xcode for compiling and terminal on apple macintosh for doing my work.
-RED