Code:
printf("word = %s\n", word); // debug
You never null terminate word, so this will overflow.
Code:
word_array[a] = word;
Nope, this wont work. You overwrite the word array for every word, so you basically have every index in word_array pointing to the same exact thing.
You need to do something like this:
Code:
word_array[a] = malloc(strlen(word) + 1);
strcpy(word_array[a],word);
First of all, delete is a C++ keyword, not C. Second of all, it only works on dynamically allocated memory which word is not.
Not sure why this is here, but take it out as it does nothing.
Code:
printf("%c\n", word_array);
No. First of all, to print a string, use %s, not %c. Second of all, word_array is NOT a string, it is an array of strings. More appropriate would be:
Code:
printf("%s\n", word_array[0]);