早教吧 育儿知识 作业答案 考试题库 百科 知识分享

#includestructstudent{longnum;floatscore;structstudent*next;};intmain(){structstudenta,b,*p;a.num=231231;b.num=311;b.score=2.0;a.score=1.0;a.next=&b;p=a->next;error:invalidtypeargumentof'->'(have'structstudent')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;
}
如题,求教大神出错原因,为什么不能用->,我知道改成点可以通过编译
▼优质解答
答案和解析
指针才用->
如struct student a,*p;
对于a用点,对于p指针用->