标签:练习 for循环 bsp int 个学生 oat turn nbsp student
#include struct student //定义一个学生类 { int num; float score; struct student * next; }; int main() { struct student s1={8001,93.5},s2={8002,67.5},s3={8003,78}; struct student *head,*p;//定义头指针和指针 head = &s1;//head指向s1,s1.next指向s2,s2.next指向s3,s3.next指向NULL。 s1.next = &s2; s2.next = &s3; s3.next = NULL; for (p = head;p != NULL;p=p->next)//for循环,p指向下一个结点 printf("%d\t%.1f\n",p->num,p->score); return 1; }
标签:练习 for循环 bsp int 个学生 oat turn nbsp student
原文地址:http://www.cnblogs.com/666fengmo666/p/7594499.html