求大侠帮忙解决个链表的问题
typedef struct link{
char name;
char yuanxi;
char xingbie;
float data;
struct link *next;
}link;
link *creat(link *head)
{
int i,j=0;
link *p=NULL;
link *pr;
printf("参赛人数:");
scanf("%d",&i);
while(j<I)
{
p=(link *)malloc(sizeof(link));
if(p==NULL)
{
printf("No enough memory to alloc");
exit(0);
}
if(head==NULL)
{
head=p;
pr=head;
pr->next=NULL;
}
else
{
while(pr->next!=NULL)
{
pr=pr->next;
}
pr->next=p;
pr=pr->next;
pr->next=NULL;
}
j++;
}
return head;
}
input(link *head)
{
char name;
char yuanxi;
char xingbie;
float data;
link *p=head;
while(p!=NULL)
{
printf("姓名:");
scanf("%s",&p->name);
printf("性别:");
scanf("%s",&p->xingbie);
printf("院系:");
scanf("%s",&p->yuanxi);
printf("分数:");
scanf("%f",&p->data);
p=p->next;
}
}
void output(link *head)
{
link *p=head;
while(p!=NULL)
{
printf("%10s%10s%10s%10f",p->name,p->yuanxi,p->xingbie,p->data);
p=p->next;
}
}
void wushi()
{
printf(" 50米比赛成绩\n");
link *head=NULL;
head=creat(head);
input(head);
output(head);
}
程序运行到output(link *head)中的printf时无法运行直接结束,请教下问题出在哪?