What is the output of the following C program on a 64-bit system?
#include <stdio.h>
typedef struct {
char code;
int qty;
} Item;
int main(void) {
Item it = {'A', 5};
printf("%zu %c %d\n", sizeof(Item), it.code, it.qty);
return 0;
}
The typedef changes nothing about the layout: the char is followed by 3 padding bytes so the int is aligned, giving 8 bytes.