Difficulty: Easy
Correct Answer: Correct
Explanation:
Introduction / Context:
This conceptual question asks whether a union may contain another union (directly or via a member that is itself a union) in standard C. Understanding type composition rules helps in designing compact variant data structures.
Given Data / Assumptions:
Concept / Approach:
Standard C permits composing structs and unions from other structs and unions. A union member can be another union or a struct, and vice versa. Restrictions apply only to incomplete types and to members that would create infinite recursion by value (but pointers to the same type are fine).
Step-by-Step Solution:
Verification / Alternative check:
Example compiles: union V { int x; float y; }; union U { union V v; int k; } u; This is valid in standard C.
Why Other Options Are Wrong:
Common Pitfalls:
Confusing “nested by value” with “self-referential by pointer”; only the latter avoids infinite size problems.
Final Answer:
Correct
Discussion & Comments