Difficulty: Easy
Correct Answer: Correct
Explanation:
Introduction / Context:
On mainstream desktop and server platforms, compilers typically implement float as 4 bytes (single precision) and double as 8 bytes (double precision). However, C allows implementations to choose representations, so exact sizes are technically implementation-defined. This question asks whether the common statement is correct in practice across typical environments.
Given Data / Assumptions:
Concept / Approach:
In most environments, sizeof(float) == 4 and sizeof(double) == 8. The standard headers document limits consistent with these sizes. While exceptions exist (special embedded targets or unusual ABIs), the statement holds for the majority of platforms students encounter.
Step-by-Step Solution:
Verification / Alternative check:
Write a small program printing sizeof(float) and sizeof(double). Expect 4 and 8 on mainstream systems. Compare with FLT_MANT_DIG and DBL_MANT_DIG in
Why Other Options Are Wrong:
Common Pitfalls:
Forgetting that long double may vary (80-bit, 128-bit, or equal to double) and that exotic compilers can deviate; always verify with sizeof on target.
Final Answer:
Correct.
Discussion & Comments