Reputation: 5
skeleton.c:86:6: warning: conflicting types for ‘verifyWord’ [enabled by default]
void verifyWord(char nword) {
^
skeleton.c:79:3: note: previous implicit declaration of ‘verifyWord’ was here
verifyWord(nextword);
^
void playgame() {
.
.
.
strcpy(curword, get_random_word(dictptr));
for(;;) {
.
.
.
/*function for nextword if correct*/
verifyWord(nextword);
/* */
} /* end for loop */
.
.
.
}
void verifyWord(char nword) {
FILE * fp;
fp = fopen ("usedWords.txt", "a+");
fprintf(fp, "%d ", nword);
fclose(fp);
}
Hi, this program is supposed to be a mini word game, i am new to C. Need some help in figuring out how can i avoid the error shown in the imgur image.
the above 2 is a playgame function and a verifyWord function
Please point me in the right direction as i tried declaring above the main:
Upvotes: 0
Views: 1914
Reputation: 5079
You need to declare the function correctly with the arguments you are willing to pass in it.
Let's say for example that verifyWord
returns void
and accepts char pointer
as an argument.
The proper declaration would be:
void verifyWord (char *nextWord);
And you will use it like:
char* nextWord = NULL;
verifyWord(nextword);
Your problem is that you didn't tell your compiler how to deal with the function. You need to have explicit declaration, like the one I mentioned above, placed somewhere before the line where you call it, and it has to be within the same scope.
Upvotes: 1