Struct Padding

Given the struct from the memory alignment question, what is sizeof(Data) on a typical 64-bit system and why?

struct Data {
    char a;    // 1 byte
    int b;     // 4 bytes
    char c;    // 1 byte
};
A

16: every struct is padded to 16 bytes for cache line alignment

B

6: the compiler packs fields tightly with no gaps

C

12: the compiler inserts padding after a and after c

D

8: the compiler only pads to the nearest power of two