Which of the following statements about identifiers in C and C++ is correct?

Options

  • A. An identifier can begin with a digit.
  • B. An identifier can contain a space.
  • C. An identifier can contain letters, digits and underscore, subject to identifier rules.
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

C. An identifier can contain letters, digits and underscore, subject to identifier rules.

Detailed Explanation

Answer: (C) An identifier can contain letters, digits and underscore, subject to identifier rules.

Identifiers can contain letters, digits and underscore. However, the first character cannot be a digit.

For example, student1 and student_name are valid identifiers.

An identifier cannot contain spaces or symbols such as - in the normal identifier syntax.