typedef struct node
{
int data;
struct node* next;
}nodes;
nodes* headnode = (nodes*)malloc(sizeof(nodes));
if (headnode == NULL) { printf("创建头指针失败\n"); exit(-1); }
headnode->next = NULL;
return headnode;
void conglianbiaozhongshancuyuansu(nodes* head,int x)
{
nodes* p = head;
nodes* y = head->next;
while (p->next!= NULL)
{
if (y->data == x)
{
p->next = y->next;
free(y);
}
p = p->next;//警告c6001
y = y->next;//警告c6001
if (y == NULL)
{
printf("在该链表中未找到此元素\n");
exit(-1);
}
}
}
不知道为啥会出现警告,有没有大佬帮我看看怎么改
p->next和y->next是不是没初始化