list *attachnode(list *tmp,list *hd)//function to get the ip address
{
if(hd==NULL)
{
hd=tmp;
}
else
{
tmp->next=hd;
hd=tmp;
}
return(hd);
}
tmp->next=hd 默认给出不兼容类型指针转换的警告 “下一个”是列表类型。
最佳答案
你说“下一个”是“列表类型”,但我相信它应该是“列表*”类型
但是如果没有您的 typedef,我们无法确定
好的,你的评论,我的编辑:
它应该是typedef struct list {...;结构列表 *next;} 列表;
原因是,C确实需要前向声明,否则它无法确定next的“类型”。可视化:typedef struct {xxx *next;} yyy;
关于c - C套接字编程中不兼容的指针类型转换警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19212483/