#includestruct 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);re
来源:学生作业帮助网 编辑:作业帮 时间:2024/08/09 22:28:30
![#includestruct 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(](/uploads/image/z/12246402-66-2.jpg?t=%23includestruct+student%7Blong+num%3Bfloat+score%3Bstruct+student+%2Anext%3B%7D%3Bint+main%28%29%7Bstruct+student+a%2Cb%2C%2Ap%3Ba.num%3D231231%3Bb.num%3D311%3Bb.score%3D2.0%3Ba.score%3D1.0%3Ba.next%3D%26b%3Bp%3Da-%3Enext%3B+error%3Ainvalid+type+argument+of+%27-%3E%27+%28have+%27struct+student%27%29printf%28%22%25ld%22%2Cp-%3Enum%29%3Bre)
#includestruct 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);re
#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 *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);re
指针才用->
如struct student a,*p;
对于a用点,对于p指针用->