Bird
0
0

Consider the following C code snippet:

medium📝 Predict Output Q13 of 15
C - Variables and Data Types
Consider the following C code snippet:
printf("%zu", sizeof(long));

What is the expected output on a typical 64-bit system?
A8
B4
C2
D16
Step-by-Step Solution
Solution:
  1. Step 1: Understand sizeof operator on 64-bit systems

    On most 64-bit systems, long is 8 bytes (64 bits).
  2. Step 2: Match the output of sizeof(long)

    The sizeof operator returns the size in bytes, so it returns 8.
  3. Final Answer:

    8 -> Option A
  4. Quick Check:

    long = 8 bytes on 64-bit [OK]
Quick Trick: On 64-bit, long is usually 8 bytes [OK]
Common Mistakes:
  • Assuming long is 4 bytes on 64-bit
  • Confusing bits with bytes
  • Using wrong format specifier in printf

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Quizzes