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