不完整声明
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | /* 方法一 */struct tag_a{ struct tag_b *bp; /* 这里struct tag_b 还没有定义,但编译器可以接受 */ int value;};struct tag_b{ struct tag_a *ap; int value;};typedef struct tag_a A;typedef struct tag_b B; /* 方法二 */struct tag_a; /* 使用结构体的不完整声明(incomplete declaration) */struct tag_b;typedef struct tag_a A; typedef struct tag_b B;struct tag_a{ struct tag_b *bp; /* 这里struct tag_b 还没有定义,但编译器可以接受 */ int value;};struct tag_b{ struct tag_a *ap; int value;}; |
浙公网安备 33010602011771号