Quote:
Originally Posted by firstfire
You forget about c-array alignment (row-major) -- swap dimentions:
char words[max_word_length][1000];
|
Why?
char words[1000][max_word_length];
defines an array of 1000 strings with a length of max_word_length each, and I think, that's what true_atlantis wants.
By the way, your loop-head should rather look something like this:
while(fgets(string,sizeof(string),file) != NULL
&& num_words < 1000)