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.

  1. 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.
  2. Whitespace characters (tabs, spaces, newlines) should be counted.
  3. 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!