Hey guys, I am stuck with another C programming problem that I can't seem to get around.
The problem I am having is trying to read a file of words, like a story, into an array of strings. What I've gathered so far is that you can use a char pointer with each spot being a unique string or word. But what I can't seem to figure out is how to get each word from the file into its own spot in the array. The maximum number of words is 1000 and the maximum number of characters per word is 80, but that must be allocated using malloc().
So far, I have the pointer defined as:
Which, to my understanding, should allow me to do something like:Code:char *words[1000];
Which should then store Hello in the first spot of words. Am I correct in this thinking? If so, then I can't figure out a way to pull a word out of the file one by one.Code:words[0] = "hello"; words[1] = "world!";