Exercise #1.5.2 - Character Counting

alendr · updated September 15, 2021 · C
#include <stdio.h>
/* Count characters in input. */ 
int main() {
    long nc; 
    while (getchar() != EOF) 
          ++nc; 
    printf("%ld\n", nc); 
    return 0;
            }

Comments

Please sign up or log in to contribute to the discussion.