Displaying ./code/cs256su21code/jul01/readChar.c/*
using getchar to count the number of characters entered through
stdin, use CTRL+D to send the end of file signal to the computer.
(note: you may need to press CTRL+D twice, depending on the system)
*/
#include <stdio.h>
int main(){
char ch;
int count = 0;
while((ch = getchar()) != EOF){
count++;
}
printf("\nNumber of characters entered: %d\n", count);
return 0;
}
|