私はそれに値を割り当てるための構造体を持っています。しかし、私のプログラマーはそれをクラッシュさせます。うまくいけばあなたは私を助けることができる。structに値を代入する方法は?
あなたは一つの要素によって作成時にあまりにも多くを反復struct HashEntry{
std::string key; //the key of the entry
bool used; //the value of the entry
int value; //marks if the entry was used before
};
HashEntry *initHashList(int N){
HashEntry* hashList = new HashEntry[N];
for (int i = 0; i <= N; i++){
hashList[i].key = " ";
hashList[i].value = -1;
hashList[i].used = false;
}
for(int i = 0; i <N; i++){
cout<<hashList[i].value<<endl;
}
return hashList;
}
最初のループの 'i <= N'は' i
dfri
'i <= N'を' i