学生成绩链表处理

p=(struct stud_node *)malloc(sizeof(struct stud_node));
p->next=NULL;
p->num=k;
scanf("%s %d",p->name,&p->score);
// p->next=NULL;这个有无都可以;
tip->next=p;//?这个的先后顺序?
tip=p;
}
return head;
}
struct stud_node *deletelist( struct stud_node *head, int min_score ){
struct stud_node *p;
int flag;
p=head;//同样是为了不被同化;
while(p->next){
flag=0;
if(p->next->score<min_score){
p->next=p->next->next; //这句话什么意思?应该是把下一个的下一个赋给下一个;
flag=1; //状态变量;
}
if(flag==0)//没有删除才往后走,有删除原地待命!
p=p->next;
}
return head->next;
}

发布了32 篇原创文章 · 获赞 8 · 访问量 1962

猜你喜欢

转载自blog.csdn.net/qq_44727672/article/details/88379105