【发布时间】:2017-01-16 18:14:24
【问题描述】:
我有这个:
typedef struct{
field_1;
field 2;
.....
}student;
typedef struct{
student record[100];
int counter;
}List;
然后我想添加每个“学生”的信息,例如:
List *p;
gets(p->list[index]->field_1);
但是当我编译代码时它抛出了这个:
[Error] base operand of '->' has non-pointer type 'student'
那么为什么我不能指向“列表”以及访问“列表”中特定“记录”的方式?
【问题讨论】:
-
使用
.运算符代替->(第二个).. -
或者complentarty创建一个指向student的指针数组。