- #1
physics kiddy
- 135
- 1
Please explain what this C code will do :
#include <stdio.h>
/* count characters in input; 1st version */
main()
{
long nc;
nc = 0;
while (getchar() != EOF)
++nc;
printf("%ld\n", nc);
}
'The C Programming' Book says that this code counts characters but it doesn't do the same ... why ?
Thanks
#include <stdio.h>
/* count characters in input; 1st version */
main()
{
long nc;
nc = 0;
while (getchar() != EOF)
++nc;
printf("%ld\n", nc);
}
'The C Programming' Book says that this code counts characters but it doesn't do the same ... why ?
Thanks