Question: C/C++ Programming in a UNIX Environment. [50] Write a C program to count the total number of commented characters and words in a C file
C/C++ Programming in a UNIX Environment.
[50] Write a C program to count the total number of commented characters and words in a C file taking both types of C file comments (single line and block) into account.
- You should count what is inside or follows the comments (// and /* */)only. You can assume that comments have been added correctly. The // comment continues until a newline and /* ends with */ sequence.
- Whitespace characters (tabs, spaces, newlines) should be counted.
- The program simply allows user redirect a C file as input. $./a.out < infile.c
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
