In this program user ask to print out the char of a file along with their positions. As user declare the variables for containing the value in it. Here user pointer type variable declaring then ask to enter the file name. if condition will checks out the has file exist or not if the file not exist the message will be file cant open if it exist the while condition will checks out all the character to EOF. With the method of display all the characters will be counted as output.
This is C program to count the character in a file.
- Declare the variables.
- Using control statements.
- Display output as result.
Here is C source code counting the character in a file. The output of this program shown below.
printf("Enter file Name :");
printf("file can't be opened");