Counts the number of characters in its input up to the end of file. - C File

C examples for File:File Read

Description

Counts the number of characters in its input up to the end of file.

Demo Code

#include <stdio.h>

int main(void)
{
  int count = 0;//from   w  ww .j  a  v a  2s . co m

  while (getchar() != EOF)
  {
    count++;
  }
  printf("Character count: %d\n", count);

  return 0;
}

Result


Related Tutorials