为什么VS2010提示“从“XXX *”到“XXX *”的类型不兼容”
是一个关于链表的程序,结构定义如下:
typedef struct
{
unsigned char phone[15];
unsigned char name[15];
unsigned char address[30];
struct infotree *next;
}infotree;
infotree head;
infotree *added;
infotree *cur=&head;
cur->next=added;
有如下的警告,这两个是一模一样的指针类型啊
1>f:\workspaces\task\numberquery(hash)\numberquery(hash)\hashutils.h(108): warning C4133: “=”: 从“infotree *”到“infotree *”的类型不兼容
[解决办法]
typedef struct _infotree
{
unsigned char phone[15];
unsigned char name[15];
unsigned char address[30];
struct _infotree *next;
}infotree;
[解决办法]
因为你的struct里面有struct infotree
编译器会认为你在struct里声明了一个相同名字的不同的struct