Welcome to the World of Online Learning:
Hello Friends “This blog helps you to learn C programming concepts. You can learn C language at your own speed and time. One can learn concepts of C language by practicing various programs given on various pages of this blog. Enjoy the power of Self-learning using the Internet.”

Write a C program to Count characters of file
PROGRAM: Count characters of file
/* Count characters of file */
#include<stdio.h>
int main()
{
FILE *fp;
char a[10];
long cnt=0;
int c;
printf("Type a file name : ");
gets(a);
if((fp=fopen(a,"r"))==NULL)
printf("File dosen't exist.");
else
{
while(1)
{
c=fgetc(fp);
if(feof(fp)) break;
cnt++;
}
printf("\nfile have %ld characters",cnt);
}
fclose(fp);
return 0;
}