I've just started to learn C programming, using book 'The C Programming Language' by Kernighan and Ritchie.
I'm on 1.5.2, and the following program (provided in the book) is supposed to count characters that I type in:
Code:
#include <stdio.h>
/* count characters in input; 1st version */
main()
{
long nc;
nc = 0;
while (getchar() != EOF)
++nc;
printf("%ld\n", nc);
}
However, when I build and run the program (using Code::Blocks and Pelles C IDE compilers), the program does not count and display the characters I input.
On Code::Blocks, I received no warnings or errors when compiling, but on Pelles, I received the following warning on compilation:
C:\Users\...\Documents\cpractice2\cpracticeb1.5.2. c(4): warning #2099: Missing type specifier; assuming 'int'.
I would like to know what may be wrong. Thanks.