C program to find number of lines in a file
In this program, we are going to learn how to find total number of lines available in a text file using C program?
This program will open a file and read file’s content character by character and finally return the total number lines in the file. To count the number of lines we will check the available Newline (\n) characters.
File "test.text"
Hello friends, how are you?
This is a sample file to get line numbers from the file.
Program to get/find total number of lines in a file in C
Output
need an explanation for this answer? contact us directly to get an explanation for this answer