C结构体嵌套
1 struct Inner; 2 3 struct Outer 4 { 5 long id; 6 7 struct Inner *inner; 8 9 }; 10 11 struct Inner 12 { 13 long seq; 14 }; 15 16 int main(int argc, char const *argv[]) 17 { 18 struct Outer outer = {112123}; 19 20 printf("%lu\n", sizeof(outer.id)); 21 return 0; 22 }
丢在使用Struct后定义细节的 Struct 需要提前声明 “
struct Inner;
”