What is the primary purpose of a semicolon in C++?

Options

  • A. To terminate many statements
  • B. To start a class declaration
  • C. To declare a header file
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

A. To terminate many statements

Detailed Explanation

Correct Answer: A — To terminate many statements.

Explanation: In C++, a semicolon terminates many statements, such as declarations and expression statements. Example: int x = 10;