#include<stdio.h>
#define NULL 0
struct stu {
long no;
long score;
struct stu* next;
};
int main() {
struct stu a, b, c, * head, * p;
a.no = 10101; a.score = 89.5;
b.no = 10103; b.score = 90;
c.no = 10107; c.score = 85;
head = &a;
a.next = &b;
b.next = &c;
c.next = NULL;
p = head;
do {
printf("%ld %5.lf\n", p->no, p->score);
p = p->next;
}while(p != NULL);
return 0;
}
C语言简单的链表
最新推荐文章于 2024-08-02 21:35:20 发布