ProgrammingHard

struct F { char c; double d; }; printf("%zu", sizeof(struct F)); What is printed with natural alignment and 8-byte double?

  1. A. 16
  2. B. 9
  3. C. 12
  4. D. 8

Correct answer: A. 16

c is at offset 0, d is aligned to offset 8, and the total of 16 is a multiple of 8.

More C Programming questions

Exams that ask this topic