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