- #1
bakin
- 58
- 0
Homework Statement
Code:
#include <stdio.h>
main()
{
long nc;
nc=0;
while (getchar() !=EOF)
++nc;
printf("%ld\n", nc);
}
Homework Equations
The Attempt at a Solution
I'm trying to learn C and am using the book "C Programming Language". It says that the above program counts characters. But, when I run it and enter something, it just skips down to the next line without doing anything. There's a similar code in the next section that counts lines, and it does the same thing. Am I missing something?