#include <stdio.h>
typedef struct {
char a;
int b;
short c;
} MyStruct;
void print_offsets() {
MyStruct stc;
printf("Offset of a: %d\n", (int)((char*)&stc.a - (char*)&stc));
printf("Offset of b: %d\n", (int)((char*)&stc.b - (char*)&stc));
printf("Offset of c: %d\n", (int)((char*)&stc.c - (char*)&stc));
printf("Size: %d\n", sizeof(MyStruct));
}
int main() {
print_offsets();
return 0;
}