作业系列静态链表

来源:互联网 发布:js 模拟鼠标点击 编辑:程序博客网 时间:2024/05/22 15:13
#include<stdio.h>struct student{    int num;    float score;    struct student *next;}a,b,c;int main(){    struct student *p,*head;    a.num=10101;b.num=10103;c.num=10107;    a.score=89.5;b.score=90;c.score=85;    head=&a;    a.next=&b;    b.next=&c;    c.next=NULL;    p=head;    do    {        printf("%d %f\n",(*p).num,(*p).score);        p=(*p).next;    }while(p!=NULL);    return 0;}

留作业要写链表。。。稍微注意一下括号是直接打在(*p)上就行了
其实p->也行。。

原创粉丝点击