0
typedef struct s {
  int x;
  int y;
} S;

typedef struct t {
  S s;
}

T t = {0};
T *pointer_to_T = &t;


printf("End address %x", pointer_to_T->s);
printf("Beginning address %x", &(pointer_to_T->s));

私のテストに基づくと、pointer_to_T->s は構造体 S の末尾のアドレスです

pointer_to_T->s - &(pointer_to_T->s) = sizeof(S)

ここで期待される動作は何ですか? それともこれは単なる偶然ですか?

4

2 に答える 2