Difficulty: Easy
Correct Answer: 65486, 65486
Explanation:
Introduction / Context:
This question clarifies the difference between the expressions arr and &arr in C, especially when printed as numeric addresses.
Given Data / Assumptions:
Concept / Approach:
In expressions, arr decays to a pointer to its first element, i.e., &arr[0]. The expression &arr is a pointer to the entire array type int (*)[5]. Both point to the same starting address in memory, even though their types and pointer arithmetic semantics differ. Therefore, when cast to an integer and printed, the numeric values are equal.
Step-by-Step Solution:
arr → &arr[0] → address 65486.&arr → address of the whole array object → also 65486.Printing both yields “65486, 65486”.
Verification / Alternative check:
Print (arr+1) and (&arr+1) to see different arithmetic: arr+1 advances by sizeof(int); &arr+1 advances by sizeof(arr).
Why Other Options Are Wrong:
They assume the addresses differ, which is false; the base address is identical though pointer types differ.
Common Pitfalls:
Confusing equal starting addresses with identical pointer types; using %u/%p incorrectly (formally, %p is the correct specifier for addresses).
Final Answer:
65486, 65486
Discussion & Comments