1、链表初步
/*
*copyright(c) 2018,HH
*All rights reserved.
*作 者:HH
*完成日期:2018年9月4日
*版本号:v1.0
*
*问题描述:链表初步
*输入描述:;
*程序输出:
*/
#include<stdio.h>
struct student
{
int num;
float score;
struct student *next;
};
int main()
{
struct student a,b,c,*head,*p;
//各节点赋值
a.num=1011;
a.score=99;
b.num=1012;
b.score=100;
c.num=1013;
c.score=98;
//各节点链接
head=&a;
a.next=&b;
b.next=&c;
c.next=NULL;
//输出链表
p=head;//指向链表首地址!!!
do
{
printf("%d %lf\n",p->num,p->score);
p=p->next;
}
while(p!=NULL);
return 0;
}