Is there a way to count the number of lines in my file using C?
Please think for a moment about what you have to do to count lines in a file:
Open the file for reading, maybe with fopen( );
Read each line, one line at a time, maybe with fread( );
Increment a line counter that you've initialized to zero earlier;
Whwn end-of-file is returned from the next read of the file, you are done. printf( ) the line counter.