C Programming - Issues with return
Hello. So i am writing this function for my hangman game, this function is to randomly select a word from a text and return the word so it can be used in my other functions for the program. But it wont run for the following errors appear:
In function `Get_Word':
warning: return makes integer from pointer without a cast
warning: function returns address of local variable
I would greatly appreciate any help fixing the problem;
insert Code:
int Get_Word(){
//gets random number using the WordCount function and then goes into the dictionary
//text file and pulls out the word that corresponds to the random number
int N_Num = WordCount();
int i, number;
char SecretWord[15];
//Random number generator
srand(time(NULL));
number = rand() % N_Num;
//opens file
FILE*dict = fopen("dictionary.txt", "r");
//gets the ord from the dictionary file using the random number picked
for(i=0; i <= number; i++){
fgets(SecretWord, 15, dict);
}
fclose(dict);//closes file
return SecretWord;
}