🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Structures and Unions: all 10 questions

Quiz: Structures and Unions · Question 4 of 10

Why can sizeof(struct) be bigger than the sum of its members?

Why can sizeof(struct) be bigger than the sum of its members?

  1. A.Because of the null character
  2. B.Because of padding for alignment
  3. C.Because structs store their name
  4. D.It can't be bigger
Answer & explanation

Correct answer: Because of padding for alignment

The compiler inserts padding so members are aligned.

Can you get the rest right without peeking?

Take the timed Quiz: Structures and Unions quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →