In most expressions, what does the name of a built-in C++ array represent or convert to?

Options

  • A. The number of elements in the array
  • B. A pointer to its first element
  • C. The last element of the array
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

B. A pointer to its first element

Detailed Explanation

Answer: (B) A pointer to its first element

In most expressions, the name of a built-in array undergoes an array-to-pointer conversion.

For example:

int a[5];

In an expression, a generally converts to a pointer to its first element, which is equivalent in value to &a[0].

This rule is important when arrays are passed to functions and when array expressions are used with pointers.