C program to print given number of lines of a file (like head command in Linux)
This program will print the given number of lines of a file, just like Head command in Linux. Head command displays only the given number of lines of a given file name. Same as head command in this program you have to supply file name then number of lines.
The syntax of executing this program
./program-name file-name N
Here N is the number of lines, if available lines in the file are less than N, program will display all lines of the file.
C program to print given number of lines of a file
linux head command implementation
Output
need an explanation for this answer? contact us directly to get an explanation for this answer