LearnFrenzy
Sign in Take a free test

Structures, Unions, Enums · Structures, Unions & Enums MCQ · Question 2

sizeof(struct { char c; int i; }) in C Answer, explanation & discussion

  • MCQ
  • Medium
  • 0 comments
  • Answer explained
  • Moderated community
Question 2 Back to Exercise

On a typical 64-bit system, what is sizeof(struct { char c; int i; })?

  • A 5
  • B 8 Correct
  • C 6
  • D 16
Correct Answer: Option B

The int must start at a multiple of 4, so 3 padding bytes follow c: 1 + 3 + 4 = 8. The size of a struct is often larger than the sum of its members.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links