【题目】建立一个如图11-11所示的简单链表,它由3个学生数据的结点组成。输出各个结点中的数据。
#include<stdio.h>
struct student
{
long num;
float score;
struct student *next;
};
int main()
{
struct student a,b,c,*head,*p;
a.num=10101;a.score=89.5;
b.num=10103;b.score=90;
c.num=10107;c.score=85;
head=&a;
a.next=&b;
b.next=&c;
c.next=NULL;
p=head;
do
{
printf("%ld %f\n",p->num,p->score);
p=p->next;
}while(p!=NULL);
return 0;
}