Which of the following is a valid identifier in C++ ?
Please first select an option.
The correct answer is C) VAR_1234
Let's analyze each option:
- A) 7var_name : This identifier starts with a digit (7), which is not allowed. Identifiers cannot start with digits.
- B) 7VARNAME : This identifier also starts with a digit (7), which is not allowed. Identifiers cannot start with digits.
- C) VAR_1234 : This identifier follows all the rules. It starts with letters (VAR), followed by an underscore and digits (1234). This is a valid identifier.
- D) $var_name : This identifier starts with a dollar sign $, which is not allowed in C++. So, this is not a valid identifier as well.