/* CSE 351 */ #include #include #include #include // for offsetof // From 14sp final exam typedef struct data_struct { int a; int *b; int c; } data_struct; int main(int argc, char* argv[]) { data_struct my_data_struct; int n = 5; printf("sizeof data_struct = %d\n", (int) sizeof(data_struct)); printf("offset of a in data_struct = %d\n", (int) offsetof(struct data_struct, a)); printf("offset of b in data_struct = %d\n", (int) offsetof(struct data_struct, b)); printf("offset of c in data_struct = %d\n", (int) offsetof(struct data_struct, c)); printf("address of c in data_struct = %p\n", &(my_data_struct.c)); printf("address of b in data_struct = %p\n", &(my_data_struct.b)); printf("address of a in data_struct = %p\n", &(my_data_struct.a)); printf("address of n = %p\n", &(n)); return 0; }