Count semicolons by source context

The following fragments appear inside main in three separate C startup programs, with the required standard output declarations already available. Count every semicolon character shown, classifying each by its source context. Enter exact integer counts in the table.


A statement terminator ends a C statement; a semicolon inside quoted text or a comment does not serve that role.


Harbour


C
puts("ready; waiting");
return 0;


Airport


C
/* startup; retry; */
puts("ready");
return 0;


Depot


C
puts("ready;"); /* note; */
puts("go"); // next;
return 0;
ProgramStatement terminatorsInside stringsInside comments
Harbour
Airport
Depot

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Introduction to C Questions: