我未能正确转换整数。我怎么做错了?
void spellCheck(char article[], char dictionary[]) {
char articleWord[50];
char dictionaryWord[50];
int articleLength = articleLength(char article[]);
removePunc(article);
toLower(article);
lowerDictionary(dictionary);
nextArticleWord(article, articleWord, articleLength, dictionary);
}
错误发生在:
int articleLength = articleLength(char article[]);
并且在声明nextArticleWord()时发生另一个错误:
void nextArticleWord(char article[],
char articleWord[],
int articleLength,
char dictionaryWord[],
char dictionary[])
可能与不正当演员有关...
完整代码为here。
答案 0 :(得分:1)
本地整数变量articleLength
似乎与使用相同名称的全局函数冲突。
未正确调用函数articleLength(char[])
。
试试这个:
void spellCheck(char article[], char dictionary[]) {
char articleWord[50];
char dictionaryWord[50];
int articleLen = articleLength(article);
removePunc(article);
toLower(article);
lowerDictionary(dictionary);
nextArticleWord(article, articleWord, articleLen, dictionary);
}
答案 1 :(得分:-1)
试试这个:
希望可以帮到你!int articleLength = strlen(article);
或
int articleLength = sizeof(article);