Difficulty: Medium
Correct Answer: 4, 8, 12
Explanation:
Introduction / Context:
This question focuses on literal suffixes and type sizes. In C, 3.14f is float, 3.14 is double, and 3.14l (or 3.14L) is long double. The exact size of long double is implementation-defined.
Given Data / Assumptions:
Concept / Approach:
Map each literal to its type via the suffix and then to its size: f → float, none → double, l/L → long double.
Step-by-Step Solution:
sizeof(3.14f) → sizeof(float) → 4.sizeof(3.14) → sizeof(double) → 8.sizeof(3.14l) → sizeof(long double) → 12 on the assumed platform.
Verification / Alternative check:
On other platforms (notably many 64-bit Linux systems), long double can be 16 bytes. On MSVC, long double may equal double (8 bytes). The question specifies the 12-byte assumption to avoid ambiguity.
Why Other Options Are Wrong:
4,4,4 and 4,8,8 ignore the long double difference.4,8,10 is not a typical size tuple for standard ABIs.
Common Pitfalls:
Forgetting literal suffixes or assuming sizes are universal across compilers and architectures.
Final Answer:
4, 8, 12
Discussion & Comments