Which of the following is a valid declaration of a character array in C++?

Options

  • A. char letters[5];
  • B. char[5] letters;
  • C. letters char[5];
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

A. char letters[5];

Detailed Explanation

Correct Answer: Option A — char letters[5];

Explanation: The element type comes first, followed by the array name and its size in square brackets. char letters[5]; declares an array that can store five characters.