When a built-in array is passed to a function in the usual way, what is generally passed to the function?

Options

  • A. A complete independent copy of the entire array
  • B. Information referring to the array elements, commonly represented through a pointer to the first element
  • C. Only the last element
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

B. Information referring to the array elements, commonly represented through a pointer to the first element

Detailed Explanation

Answer: (B) Information referring to the array elements, commonly represented through a pointer to the first element

When a built-in C-style array is passed to a function in the usual parameter form, it does not get copied as a complete array.

For example:

void display(int a[], int n)

The array parameter is treated in the function parameter context as a pointer to its first element.

Therefore, changes made to array elements through the function can affect the original array.

Also remember that the function normally needs the array size separately because the array parameter itself does not automatically carry the number of elements.