I have a function in my spell checker codes to load words from a text file and store them in an array of strings.. Problem is, I can't figure out how to correct it.
For instance, the 'dictionary' text file has:
line1
line2
line3
and my code goes:
How do I correct it so it doesn't store "line3" in every single element of my array?Code:// assuming I only have 10 words, and done all other necessary declarations.. char *words[10]; for (i=0; fgets(s, 9, dict) != NULL; i++) words[i] = s;