c语言的错误not in formal parameter list
structSTUDENT*Insert(structSTUDENT*head,intstudentID){structSTUDENT*p=head;structSTUD...
struct STUDENT *Insert(struct STUDENT *head,int studentID){ struct STUDENT *p=head; struct STUDENT *pr=head; struct STUDENT *temp=NULL; p=(struct STUDENT*)calloc(sizeof(struct STUDENT)); //为指针p申请内存 if(p==NULL) //若内存不够则返回 { head=p; } p->next=NULL; //让新节点为空指针 p->StudentID=studentID; if(head==NULL) { head=p; } else { while(pr->StudentID<studentID&&pr->next!=NULL) //找到新节点的位置 { temp=pr; pr=pr->next; } if(pr->StudentID>=studentID) { if(pr==head) //若新节点的位置为开头则让开头为新节点 { p->next=head; head=p; } else //若不是则插入该节点 { pr=temp; p->next=pr->next; pr->next=p; } } else { pr->next=p; //如果在表尾则插入节点 }
error C2085: 'Insert' : not in formal parameter listerror C2143: syntax error : missing ';' before '{'error C2065: 'head' : undeclared identifier 展开
error C2085: 'Insert' : not in formal parameter listerror C2143: syntax error : missing ';' before '{'error C2065: 'head' : undeclared identifier 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询