I just started writing C programs and I am taking help of The C Programming book written by Dennis Ritchie. When I tried to run the program for COUNTING characters or new lines, i was expecting some numbers as solutions but it didn't happen, instead it just allowed me to enter characters, with no value( of the number of lines/ characters) in return. I am new to programming. I would appreciate some help to get me through.
character counting
#include <stdio.h>
main( )
{
long nc;
nc=0;
while (getchar( ) != EOF)
++nc;
printf( "%1d\n", nc );
}