ProgrammingHard

Using natural alignment, what is sizeof(struct { char c; short s; })?

  1. A. 4
  2. B. 3
  3. C. 2
  4. D. 5

Correct answer: A. 4

c is at offset 0, a pad byte puts s at offset 2, and the struct size is 4.

More C Programming questions

Exams that ask this topic