为什么出错了?什么原因??
#include<stdio.h>
#include<malloc.h>
#include<string.h>
struct stu{
int num;
char name[20];
char sex;
float score;
}student[2]={{050101,"许元元",'w',502},{050102,"张帆",'m',498}};
typedef struct node{
struct stu data;
struct node *next;
}Llist,*linklist;
createList(linklist p,struct stu student[],int n)
{linklist h=NULL;
int i;Llist *s,*r;
for(i=0;i<n;i++)
{s=(Llist *)malloc(sizeof(Llist));
s->data.num=student[i].num;
strcpy(s->data.name,student[i].name);
s->data.sex=student[i].sex;
s->data.score=student[i].score;
s->next=NULL;
if(h==NULL){h=s;r=s;}
else{r->next=s;
r=s;}
}
}
main()
{Llist *a1=NULL,*p;
createList(&a1,student,2);
p=a1;
while(p)
{printf("\n%d\t%s\t%c\t%f",p->data.num,p->data.name,p->data.sex,p->data.score);
p=p->next;
}
}