#include<stdio.h>
typedef struct student
{
int num;
float score;
struct student *next;
}stu; //命名了一个新的类型名代表结构体类型
void create()
{
stu a,b,c,*head,*p; //a,b,c为三个链表的结点,head为头结点
a.num=101;a.score=85.5;
b.num=102;b.score=90.5;
c.num=103;c.score=95;
head=&a;
a.next=&b;
b.next=&c;
c.next=NULL;
p=head; //使p指向头结点
printf("学号 分数\n");
do
{
printf("%d %9.1f\n",p->num,p->score);
p=p->next;
}while(p!=NULL);
}
int main()
{
create();
return 0;
}