Which of the following is a valid identifier in C?

Options

  • A. 2value
  • B. total-marks
  • C. _total
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

C. _total

Detailed Explanation

Answer: (C) _total

A C identifier may contain letters, digits and underscore, but it cannot begin with a digit.

2value is invalid because an identifier cannot start with a digit.

total-marks is invalid because the hyphen is not allowed in an identifier.

_total follows the basic identifier rules and is syntactically valid.