したがって、最大長19の単語の辞書をスキャンし、メモリを動的に割り当てて辞書配列のサイズを設定する必要があります。私はこれを行う方法にこだわっています。
fscanf(ifp, "%d", &numwords); //Number of words in dictionary
char ** dictionary;
for(i = 0; i < numwords; i++){
for(j = 0; j < 20; j++){
dictionary[i][j] = (char *) malloc(20 * sizeof(char));
fscanf(ifp, "%s", &dictionary[i][j]);
//printf("%s\n", dictionary[i]); //tests that the letter is read in correctly
}
}
何が悪いのか迷っています。どんな助けでも大歓迎です。