Difficulty: Medium
Correct Answer: 2
Explanation:
Introduction / Context:
The question examines how C packs bit-fields into storage units of the underlying type. With int-based bit-fields on a 16-bit Turbo C model, packing typically occurs within a single 16-bit int until capacity is exceeded.
Given Data / Assumptions:
Concept / Approach:
C compilers pack successive bit-fields of the same base type into the same unit as long as they fit. Here 9 bits fit into one 16-bit int unit; alignment may keep the struct size to that unit boundary when no overflow occurs.
Step-by-Step Solution:
Verification / Alternative check:
Under Turbo C conventions, consecutive int-based bit-fields pack into the same 16-bit object until overflow. No spillover occurs at 9 bits, so 2 bytes is consistent.
Why Other Options Are Wrong:
Common Pitfalls:
Assuming modern 4-byte ints or that each bit-field forces a new storage unit; packing rules allow multiple fields per unit when types and order permit.
Final Answer:
2
Discussion & Comments