(建立静态链表)由3个学生数据的结点组成,要求输出各结点中的数据

来源:互联网 发布:网络词汇用语2017最新 编辑:程序博客网 时间:2024/05/16 00:33
#include<stdio.h>struct Student{int num;float score;struct Student *next;};int 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 = 85;head = &a;a.next = &b;b.next = &c;c.next = NULL;p = head;do{printf("%ld %5.1f\n",p -> num,p -> score);p = p -> next;}while(p !=NULL);return 0;}

0 0
原创粉丝点击