Difficulty: Easy
Correct Answer: 1
Explanation:
Introduction / Context:
This item tests decay of a 2D array to a pointer to its first element and correct use of double indirection when passing a pointer by reference to a function.
Given Data / Assumptions:
Concept / Approach:
Inside fun, parameter p points to ptr; dereferencing once yields the original int; dereferencing twice yields the int value stored at that location. Since ptr points to the first element of a, **p is a[0][0] which equals 1.
Step-by-Step Solution:
ptr = &a[0][0] → ptr holds address of the first integer.fun(&ptr) passes the address of ptr.In fun, *p == ptr and *p == ptr == a[0][0] == 1.
Verification / Alternative check:
Change initialization so a[0][0] has a distinct value to confirm the print reflects that element; or print p, p to inspect addresses.
Why Other Options Are Wrong:
They assume access to other elements; the code never offsets ptr before printing.
Common Pitfalls:
Confusing type int ()[4] (pointer to array) with int; here we explicitly take &a[0][0] to get an int.
Final Answer:
1
Discussion & Comments