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

#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;
}
如题,求教大神出错原因,为什么不能用->,我知道改成点可以通过编译
渴望永恒的爱 1年前 已收到1个回答 举报

衣食生活 幼苗

共回答了14个问题采纳率:100% 举报

指针才用->
如struct student a,*p;
对于a用点,对于p指针用-

1年前

1
可能相似的问题
Copyright © 2024 YULUCN.COM - 雨露学习互助 - 16 q. 0.026 s. - webmaster@yulucn.com