What is the output of the following C program on a 64-bit system?
#include <stddef.h>
#include <stdio.h>
struct rec {
char tag;
int id;
double score;
};
int main(void) {
printf("%zu %zu %zu\n", offsetof(struct rec, id), offsetof(struct rec, score), sizeof(struct rec));
return 0;
}
tag is at 0; id needs a multiple of 4, so it starts at 4; score needs a multiple of 8 and fits exactly at 8. 8 + 8 = 16 bytes, with no tail padding needed.