struct' type redefinition

来源:百度知道 编辑:UC知道 时间:2024/06/17 16:04:59
typedef struct Chain_Node{
struct Chain_Node *next;
struct Chain_Node *previous;
}Chain_Node;
报错d:\c练习\chain\chain.h(6) : error C2011: 'Chain_Node' : 'struct' type redefinition
高手帮忙

楼上的不要乱说,这样定义是没问题的,

正确的做法是要把{}里面的 两个struct 去掉

typedef struct Chain_Node{
Chain_Node *next;
Chain_Node *previous;
}Chain_Node;

typedef struct Chain_Node{
struct Chain_Node *next;
struct Chain_Node *previous;
}chain_node;//此处不应和 Chain_Node同名.你写的应该是个链表节点吧,但是少数据项