【发布时间】:2013-09-14 08:06:57
【问题描述】:
struct box
{
char word[200][200];
char meaning[200][200];
int count;
};
struct root {
box *alphabets[26];
};
struct root *stem;
struct box *access;
void init(){
int sizeofBox = sizeof(struct box);
for(int i = 0 ; i<= 25; i++){
struct box *temp =(struct box*)( malloc(sizeofBox));
temp->count = 0;
root->alphabets[i] = temp; //error line
}
}
错误:在 '->' 标记之前需要不合格的 id
如何修复此错误。 谁能解释一下这是什么...??
【问题讨论】:
-
您可能指的是
stem而不是root,除了stem永远不会设置为任何值,这样会在运行时崩溃。也许将struct root* stem;更改为struct root stem;(无指针)。
标签: c++ c arrays pointers struct