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