作业帮 > 综合 > 作业

#includestruct student{long num;float score;struct student *

来源:学生作业帮 编辑:搜搜考试网作业帮 分类:综合作业 时间:2024/08/03 06:30:09
#include
struct student
{
long num;
float score;
struct student *next;
};
int main()
{struct student a,b,*p;
a.num=231231;
b.num=311;
b.score=2.0;
a.score=1.0;
a.next=&b;
p=a->next; error:invalid type argument of '->' (have 'struct student')
printf("%ld",p->num);
return 0;
}
如题,求教大神出错原因,为什么不能用->,我知道改成点可以通过编译
#includestruct student{long num;float score;struct student *
指针才用->
如struct student a,*p;
对于a用点,对于p指针用-