#include<stdio.h>
struct student
{
int num;
float score;
struct student *next;
}a,b,c;
int main()
{
struct student *p,*head;
a.num=10101;b.num=10103;c.num=10107;
a.score=89.5;b.score=90;c.score=85;
head=&a;
a.next=&b;
b.next=&c;
c.next=NULL;
p=head;
do
{
printf("%d %f\n",(*p).num,(*p).score);
p=(*p).next;
}while(p!=NULL);
return 0;
}
留作业要写链表。。。稍微注意一下括号是直接打在(*p)上就行了
其实p->也行。。