#include<stdio.h> //定义结构体 struct Student { int num; float score; struct Student *next; }; int main() { struct Student a,b,c,*head,*p; a.num=101;a.score=89; b.num=102;b.score=97; c.num=103;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; } |
时间: 2025-01-02 18:44:19