[Linker error] undefined reference to `print(student*)'怎么回事啊 怎么解决呀?

#include<stdio.h>#include<malloc.h>#defineLENsizeof(structstudent)structstudent{longn... #include<stdio.h>
#include<malloc.h>
#define LEN sizeof(struct student)
struct student
{long num;
float score;
struct student*next;
};
int n;

int main()
{struct student*creat();
struct student*del(struct student*,long);
struct student*insert(struct student*,struct student*);
void print(struct student*);
struct student*head,stu;
long del_num;
printf("input the deleted number:");
scanf("%ld",&del_num);
head=del(head,del_num);
print(head);
printf("input the inserted record:");
scanf("%ld%f",&stu.num,&stu.score);
head=insert(head,&stu);
print(head);
getchar();
getchar();
return 0;
}

struct student*creat()
{struct student*head ;
struct student*p1,*p2;
n=0;
p1=p2=(struct student*)malloc(LEN);
scanf("%ld%f",&p1->num,&p1->score);
head=NULL;
while(p1->num!=0)
{n=n+1;
if(n==1)head=p1;
else p2->next=p1;
p2=p1;p1=(struct student*)malloc(LEN);
scanf("%ld%f",&p1->num,&p1->score);
}
p1->next=NULL;
return(head);
}

struct student*del(struct student*head,long num)
{struct student*p1,*p2;
if(head=NULL)
{printf("\nlist null!\n");
return(head);
}
p1=head;
while(num!=p1->num&&p1->next!=NULL)
{p2=p1;p1=p1->next;}
if(num==p1->num)
{if(p1==head)head=p1->next;
else p2->next=p1->next;
printf("delete:%ld\n",num);
n=n-1;
}
else printf("%ld not been found!\n",num);
return(head);
}

struct student*insert(struct student*head,struct student*stud)
{struct student*p0,*p1,*p2;
p1=head;
p0=stud;
if(head=NULL)
{head=p0;p0->next=NULL;}
else
{while((p0->num>p1->num)&&(p1->next!=NULL))
{p2=p1;
p1=p1->next;
}
if(p0->num<=p1->num)
{if(head==p1)head=p0;
else p2->next=p0;
p0->next=p1;
}else
{p1->next=p0;p0->next=NULL;}
}
n=n+1;
return(head);
}
展开
 我来答
百度网友a70ce28
2012-02-12 · TA获得超过992个赞
知道小有建树答主
回答量:619
采纳率:0%
帮助的人:564万
展开全部
我看了下 发现你写的这个竟然没print函数 但是却调用了print函数
说明这个并非出自你自己之手
你在代码最后面加上
void print(struct student* head)
{
printf("num=%d,score=%f\n",head.num,head.score);
}
本回答被提问者和网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式