将链表中的数据依此输出功能
#include <stdio.h>
#include <string.h>
struct student
{
char num[20];
float grades;
struct student* next;
};
int main()
{
struct student a, b, c, * head, * p;
strcpy(a.num, "098207101");
a.grades = 89.5;
strcpy(b.num, "098207102");
b.grades = 90;
strcpy(c.num, "098207103");
c.grades = 85;
head = &a;
a.next = &b;
b.next = &c;
c.next = NULL;
p = head;
while (p)
{
printf("%s %f\n", p->num, p->grades);
p = p->next;
}
return 0;
}