链表数据增加
合集下载
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
int n;
printf("输入要创建的节点个数:");
scanf("%d",&n);
*head = chuangjian(n);
printf("input number:");
scanf("%d",&number);
searchlink(head,number);
display(head->next);
new = new->next;
}
}
void main()
{
int number;
struct stu *head;
struct stu *last;
struct stu *new;
head = (struct stu *)malloc(sizeof(struct stu));
#include<stdio.h>
#include<malloc.h>
struct stu
{
int num;
float score;
struct stu *next;
};
struct stu chuangjian(int n)
{
struct stu *new;
struct stu *last;
if(last->num == number)
{
printf("num=%d score=%f\n",last->num,last->score);
break;
}
else
{
last = last->next;
}
}
if(last == NULL)
printf("input num:");
scanf("%d",&new->num);
printf("input score:");
scanf("%f",&new->score);
new->next = NULL;
last->next = new;
last = last->next;
struct stu *head;
head = (struct stu *)malloc(sizeof(struct stu));
head->next = NULL;
new = head;
last = head;
for(;n!=0;n--)
{ Biblioteka ew = (struct stu *)malloc(sizeof(struct stu));
}
{
printf("no zhaodao\n");
}
printf("====查找======\n");
}
void display(struct stu *new)
{
while(new != NULL)
{
printf("num=%d score=%f\n",new->num,new->score);
}
return *head;
}
void searchlink(struct stu *new,int number)
{
struct stu *last;
last = new;
printf("====查找======\n");
while(last !=NULL)
{