learn_c/intro/count_char.c

13 lines
157 B
C
Raw Permalink Normal View History

2023-11-13 18:18:50 +00:00
#include <stdio.h>
/* count characters input; 1st version */
main()
{
long nc;
nc = 0;
while (getchar() != EOF)
++nc;
printf("%ld\n", nc);
}