为什么无效,求解答(在add出现的问题)

#include<stdio.h>
#include<stdlib.h>
typedef struct _node{
int value;
struct _node*next;

}Node;

typedef struct _list{
Node*head;
}List;

void add(ListPList,int number);
void print(List
PList);
int main( int argc,char *argv[])
{
List list;
int number=0;
list.head=NULL;
do{
scanf("%d",&number);
if(number!=-1){
add(&list,number);
}
while (number!=-1);
print(&list);

return 0;
}

void add(ListPList,int number)
{
Node
p=(Node*)malloc(sizeof(Node));
p->value=number;
p->next=NULL;
Node*list=PList->head;
if (last){
while (list->next){
list=list->next;
}
list->next=p;
}else {
PList->head=p;
}
}

void print(ListPList)
{
int number;
scanf("%d",&number);
Node
p;
int isFound=0;
for(p=list.head;p;p=p->next){
if(p->value==number){
printf("找到了\n");
isFound=1;
break;
}
if(isFound){
printf("未找到\n");
}
}

Node*q;
for(q=NULL,p->list.head;p;q=p,p=p->next){
if(p->value==number){
if(q){
q->next=p->next;
break;
}else {
list.head=p->next;
}
free(p);
break;
}
}
for(p=head;p;p=q){
q=p->next;
free(p);
}

}

img

你少了一个}
main函数的do whlie语句那里


do{
scanf("%d",&number);
if(number!=-1){
add(&list,number);
}//这个括号和if结合,还差一个给while
}while (number!=-1);

如果对你有帮助,还请点个采纳!

提交代码请使用代码块,你这样复制太难看了