책이 개정되면서 solution이 이전 버전과 섞인 듯 하다

아래 참고

The offset of each field and the size of the following structure declarations

Untitled

#include <stdio.h>
#include <stdlib.h>
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)

struct P1 {
  short i;
  int c;
  int *j;
  short *d;
};

struct P4 {
  char w[16];
  int *c[2];
};

struct P5 {
  struct P4 a[2];
  struct P1 t;
};

int main(void) {
  printf("PI i:%zu\\n", offsetof(struct P1, i));
  printf("PI c:%zu\\n", offsetof(struct P1, c));
  printf("PI j:%zu\\n", offsetof(struct P1, j));
  printf("PI d:%zu\\n", offsetof(struct P1, d));
  printf("PI size:%zu\\n\\n", sizeof(struct P1));

  printf("P4 w:%zu\\n", offsetof(struct P4, w));
  printf("P4 c:%zu\\n", offsetof(struct P4, c));
  printf("P4 size:%zu\\n\\n", sizeof(struct P4));

  printf("P5 a:%zu\\n", offsetof(struct P5, a));
  printf("P5 t:%zu\\n", offsetof(struct P5, t));
  printf("P5 size:%zu\\n\\n", sizeof(struct P5));
}