看程序,不知道哪里错了,链表问题
//建立简单的链表,输出各个接点的数据#include<stdio.h>
struct Student
{int num;
float score;
struct Student *next;
};
int main()
{ struct Student a[3],*head,*p;
a[3]={10101,89.5, ,10102,92, ,10103,87, };
head=&a[1];
a[1].next=&a[2];
a[2].next=&a[3];
p=head;
do
{printf("%1d%5.1f\n",p->num,p->score);
p=p->next;
}while(p!=NULL);
return 0;
}
运行提示出错,请指点……