链表方面的, 麻烦看得懂的给讲下 顺便的话带上注释 谢谢呀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;}
1 回答
- 1 回答
- 0 关注
- 1181 浏览
添加回答
举报
0/150
提交
取消