链表方面的, 麻烦看得懂的给讲下 顺便的话带上注释 谢谢呀
STU *creat_linkback(STU *h)//尾插入创建链表{ STU * H = h; STU * t = h; STU *p = (STU *)malloc(sizeof(STU)); printf ("输入学号 姓名\n"); scanf ("%d %s",&p->num,p->name); if (H == NULL) { H = p; p ->next = NULL; }else{ while(t->next != NULL) { t = t->next; } t->next = p; p->next=NULL; } return H;}
STU *creat_linkback(STU *h)//尾插入创建链表
{
STU * H = h;
STU * t = h;
STU *p = (STU *)malloc(sizeof(STU));
printf ("输入学号 姓名\n");
scanf ("%d %s",&p->num,p->name);
if (H == NULL) {
H = p;
p ->next = NULL;
}else{
while(t->next != NULL)
{
t = t->next;
}
t->next = p;
p->next=NULL;
}
return H;
} |