以下是问题的源代码:
#include <stdio.h>
typedef struct Foo
{
int a;
Bar b;
} Foo;
typedef struct Bar
{
int a;
int b;
} Bar;
int main(void)
{
Foo f;
f.a = 1;
f.b.a = 2;
f.b.b = 3;
printf("%d %d %d\n", f.a, f.b.a, f.b.b);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我想在Bar结构中声明结构,该Foo结构保持结构声明的顺序(Foo结构是第一个).但我不能,它error: unknown type name 'Bar'在编译时发生了一些错误(一个是).
怎么做?