首页 > 其他 > 详细

语法*第九章*7 简单静态链表的创建

时间:2018-05-01 21:40:17      阅读:140      评论:0      收藏:0      [点我收藏+]
#include<stdio.h>
struct student{
   int num;
   float score;
   struct student *next;
} ;
 int main(void){
  struct student stu1,stu2,stu3;  /*定义3个struct student 类型的变量*/
  struct student *head,*p;/*定义2个指向struct student的指针*/
  stu1.num=18001;stu1.score=99.0;
  stu2.num=18002;stu2.score=91.0;
  stu3.num=18003;stu3.score=92.0;
  head = &stu1;
  stu1.next=&stu2;
  stu2.next=&stu3;
  stu3.next=NULL;
  p=head;
  do{
     printf("%d%5.1f\n",p->num,p->score);
     p=p->next;
  }while(p!=NULL);
}

 

语法*第九章*7 简单静态链表的创建

原文:https://www.cnblogs.com/sunnybowen/p/8977147.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!