我正在尝试使用一个结构数组,每次我尝试为任何结构分配一个值时,它都会给我这个错误:
request for member 's' in something not a structure or union
我的结构:
struct {
char s;
int lineNum;
} item;
我是这样声明的:
struct item * stack[100];
然后:
/* both lines gives me the error */
stack[0].s = 'a';
stack[0].lineNum = 1;
我是不是漏掉了什么?
最佳答案
您没有结构项
。
stack
是一个包含 100 个指向尚未定义结构的指针的数组。
尝试
struct item {
char s;
int lineNum;
};
关于c - 在非结构或 union 中请求成员 's',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22564497/