各位朋友进来帮看看为什么错啊
程序代码:#include"stdio.h"
#include"stdlib.h"
struct information
{
long num; //学号//
char name[6];//姓名//
struct information *next;/*指向下一个结构体*/
};
int main()
{ char ch;
struct information fun();//建立链表函数的声明
struct information shuchu(struct information *);//输出链表函数声明
struct information *head;
head=fun(); //信息提示说这里的=错了,我不太懂额 f:\程序代码\list3.c(15) : error C2115: '=' : incompatible types
//输入一个y时调用输出链表的函数
ch=getchar();
if(ch=='y')
shuchu(head);
return 0;
}
//尾插法建立带有头指针的链表
struct information fun()
{
struct information *last=NULL;//尾指针
struct information *he;//头指针
struct information *p,*p1;
he=p=(struct information *)malloc(sizeof(struct information));//申请空间//
he->next=NULL;
last=he->next;
scanf("%ld",&p->num);//输入学号,姓名//
scanf("%s",p->name);
//输入信息直到学号为零//
while(p->num!=0)
{ if(he->next==NULL)
he->next=p;
else
last->next=p;
last=p;
p1=he;//将p1指向链表的表头
p=(struct information *)malloc(sizeof(struct information));//申请空间//
scanf("%ld",&p->num);
if(p->num==0)
{free(p);break;}
scanf("%s",p->name);
p->next=NULL;
}
return p1;//返回p1 这个地方提示说错了 f:\程序代码\list3.c(50) : error C2115: 'return' : incompatible types
}
//链表的遍历
struct information shuchu(struct information *head)
{while(head!=NULL)
{printf("%ld,%s\n",head->num,head->name);
head=head->next;}
}f:\程序代码\list3.c(15) : error C2115: '=' : incompatible typesf:\程序代码\list3.c(50) : error C2115: 'return' : incompatible types







