您的位置:首页 > 其它

静态链表例题

2016-01-08 16:31 447 查看
#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;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: