样例1(正确样例):
typedef struct tagTest_B TEST_B_S;
typedef struct tagTest_A
{
TEST_B_S *pstB;
} TEST_A_S;
struct tagTest_B
{
TEST_A_S *pstA;
};
样例二:
struct B;
typedef struct A
{
struct B *p;
int a;
int b;
}AAA;
typedef struct B
{
struct A *p;
int aa;
int bb;
}BBB;
样例三:
typedef struct A AAA;
typedef struct B BBB;
struct A
{
BBB *p;
int a;
int b;
};
struct B
{
AAA *p;
int aa;
int bb;
};
注:c语言与C++不同,这里的声明必须加typedef
typedef struct A AAA;
typedef struct B BBB;
参考:
https://blog.youkuaiyun.com/f290131665/article/details/17678851