一世轻尘 发表于 2020-12-13 11:06:11

点运算符与箭头运算符区别

#include<stdio.h>
struct student{
        int num;
        int score;
        struct student *next;
};
int main()
{
        struct student a,b,c,*head,*p;
        head=&a;
        a.next=&b;
        b.next=&c;
        c.next=NULL;
        a.num=1;
        b.num=2;
        c.num=3;
        a.score=90;
        b.score=91;
        c.score=92;
        p=head;
        do
        {
                printf("%d %d\n",p->num,p->score);
                p=p->next;
        }while(p!=NULL);
        return 0;
}
在do...while循环中,为什么要用p->num..而不能用p.num,两者有什么区别
求解{:10_254:}

Dadong丶 发表于 2020-12-13 14:25:42

箭头 一般 是指针采用的
页: [1]
查看完整版本: 点运算符与箭头运算符区别