Which of the following statements about arrays and pointers in C is correct?

Options

  • A. The array name generally represents the address of its first element in expressions
  • B. The array name can always be incremented like a pointer variable
  • C. An array name and a pointer variable are identical in all situations
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

A. The array name generally represents the address of its first element in expressions

Detailed Explanation

Correct Answer: The array name generally represents the address of its first element in expressions.

In most expressions, the name of an array is converted to a pointer to its first element. For example, if int a[5] is declared, then a generally behaves like &a[0].

However, an array name is not a modifiable pointer variable. Therefore, expressions such as a++ are invalid.

Also, an array and a pointer are not identical in every context. For example, sizeof(a) gives the size of the complete array, while sizeof(p) gives the size of the pointer variable.

BPSC exam point: Remember the distinction: an array name can decay to a pointer in expressions, but an array itself is not a pointer variable.