error C2065: 'print' : undeclared identifier 为什吗?????

#include <stdio.h>

#include <malloc.h>
#define NULL 0
#define LEN sizeof(struct student)

struct student
{
long num;
float score;
struct student *next;
};

int n;

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

void main()
{
struct student *head;
head=creat();
print(head);
}

第1个回答  2011-06-11
你都没有写print函数体,所以报错啊。
print这个函数是你自己的函数,又不是系统的printf函数,所以,你要完成print函数,来打印你的结构体链表的数据。
print,在c语言里,是没有这个函数的。系统提供的是有一个f的,printf.
第2个回答  2011-06-11
print(head); //print函数没有定义啊,程序少一大段都不知道吗?追问

你好 我是新手 print 不是和printf一样的打印功能吗?? 这个需要怎么定义才能实现打印功能??谢谢

本回答被提问者采纳
第3个回答  2011-06-11
error C2065:
相似回答