Difficulty: Easy
Correct Answer: Error in this float category:5; statement
Explanation:
Introduction / Context:
This item again tests the rule that bit-fields must be of integer type or _Bool. A float bit-field violates the language requirements in standard C.
Given Data / Assumptions:
Concept / Approach:
Bit-fields of floating types are not permitted. Some compilers may also restrict the underlying integer types for bit-fields; _Bool, signed int, and unsigned int are the portable choices. Therefore the error is specifically the float bit-field line, not the sizeof or printf call.
Step-by-Step Solution:
Verification / Alternative check:
Replace float with unsigned int; compile succeeds confirming the diagnosis.
Why Other Options Are Wrong:
Common Pitfalls:
Assuming any type can be a bit-field, or blaming printf instead of the declaration.
Final Answer:
Error in this float category:5; statement
Discussion & Comments