#include<stdio.h>
struct student
{
int num;
float score;
struct student *next;
};
int main()
{
struct student a, b, c, *head,*p;
a.num = 101; a.score = 25.36;
b.num = 102; b.score = 36.24;
c.num = 103; c.score = 35.14;
head = &a;
a.next = &b;
b.next = &c;
c.next = NULL;
p = head;
do
{
printf("%-5d%-5.2f\n", p->num, p->score);
p = p->next;
}while(p!=NULL);
return 0;
}
静态链表例题
最新推荐文章于 2022-09-23 21:03:50 发布