Difficulty: Medium
Correct Answer: 4, 4, 4
Explanation:
Introduction / Context:
This problem combines multi-level pointers with near/far/huge qualifiers and requires resolving the type at each dereference before applying sizeof in Turbo C (16-bit DOS).
Given Data / Assumptions:
Concept / Approach:
Unwrap one level at a time and record the qualifier at that level. sizeof reports the size of the pointer representation at the evaluated type.
Step-by-Step Solution:
1) sizeof(ptr1): ptr1 is far * ⇒ 4.2) sizeof(*ptr2): ptr2 is huge * to (far *) ⇒ *ptr2 is far * ⇒ 4.3) sizeof(**ptr3): ptr3 is near * to (huge * to (far *)) ⇒ **ptr3 is far * ⇒ 4.4) Therefore the output is 4, 4, 4.
Verification / Alternative check:
Print intermediate sizeof values for *ptr2 and **ptr3 to confirm both are far pointers.
Why Other Options Are Wrong:
Options B/C/D: Misidentify which level is being measured by sizeof or assume an incorrect 2-byte result.
Common Pitfalls:
Jumping directly to the base char type instead of recognizing that dereferencing here still yields a pointer type.
Final Answer:
4, 4, 4
Discussion & Comments