一、所需的知识。
1、数组
2、指针
二、代码展示。
#include<stdio.h>
struct stu{
int num;
float score;
struct stu *next;
};
struct stu a, b, c, *head;
void hou(){
a.num =1;
a.score = 89;
b.num = 2 ;
b.score = 98;
c.num = 3;
c.score = 99;
head = &a;
a.next = &b;
b.next = &c;
c.next = NULL;
do{
printf("student number: %d score:%f\n",head->num, head->score);
head = head->next; //head->next = head
}while(head);
}
int main(){
hou();
return 0;
}
三、总结。
本代码比较简单,不再过多讲解。