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