#include <stdio.h>
typedef struct {
char a;
int b;
short c;
} MyStruct;
void print_offsets() {
MyStruct my_struct;
int max = sizeof(my_struct.a) > sizeof(my_struct.b) ? sizeof(my_struct.a) : sizeof(my_struct.b);
max = max > sizeof(my_struct.c) ? max : sizeof(my_struct.c);
int offset = 0;
printf("Offset of a: %zu\n"
"Offset of b: %zu\n"
"Offset of c: %zu\n"
"Size: %zu",
offset, offset + max, offset + 2*max, sizeof(my_struct));
}
int main() {
print_offsets();
return 0;
}