Difficulty: Medium
Correct Answer: 2, 4, 4
Explanation:
Introduction / Context:
In 16-bit Turbo C, pointer size depends on the memory model and the pointer qualifier: near (typically 16 bits), far (32 bits segment:offset), and huge (also 32 bits but normalized). This question asks for the sizes of pointers to pointer objects with different qualifiers.
Given Data / Assumptions:
Concept / Approach:
The size reported by sizeof(ptrX) is the size of the pointer variable itself, determined by its qualifier (near/far/huge). Near pointers are 2 bytes; far and huge pointers are 4 bytes in Turbo C. The pointee type (here, a near char) does not change the size of the pointer variable.
Step-by-Step Solution:
Verification / Alternative check:
Compiling with Turbo C in small/medium model yields these sizes. Changing the variable qualifiers (e.g., making the pointee far) would not affect sizeof(ptrX), which depends on the pointer variable's own qualifier.
Why Other Options Are Wrong:
Common Pitfalls:
Confusing the qualifier placement in multi-level pointer declarations; remember sizeof applies to the variable's pointer type, not the target type's qualifier.
Final Answer:
2, 4, 4
Discussion & Comments