求助!!结构体链表的问题 ? 不知道为什么运行不了。是在老谭的书里看的。
#include<stdio.h>#define NULL 0
struct student
{
long num;
float score;
struct strdent * next;
};
void main ()
{
struct student a, b, c, *head, *p;
a.num = 10101;a.score = 89.5;
b.num = 10103;b.score = 90;
c.num = 10107;c.score = 89;
head = &a;
a.next = &b;
b.next = &c;
c.next = NULL;
p = head;
do
{
printf ("%ld %5.ld\n",p->num,p->score);
p = p->next;
}
while (p != NULL);
}