C语言的结构定义能包含自身吗?

来源:百度知道 编辑:UC知道 时间:2024/04/30 01:15:01
typedef struct{
unsigned int *left;
unsigned int *right;
TREE *next;
} TREE;

这个结构的定义有问题吗?
请指正~谢谢~
两个结构相加,是每个组分分别相加吗??还是它们的地址相加??

有问题啊,你在TREE定义之前就使用了它,编译是通不过的,你可以这样定义啊:
typedef struct _TNode{
unsigned int left;
unsinged int right;
_TNode *next;
}TREE,*PTREE;
这样就没问题了,写的看起来也比较标准.

可以啊,使用前向引用说明即可。
typedef struct tree TREE;
typedef struct tree
{
unsigned int *left;
unsigned int *right;
TREE *next;
}TREE;

没有问题