I am running into a wall here because I don't see how I can iterate over the string and use the tolower() function without severely breaking my dynamically allocating array. Any advice would be suggested.
while (fscanf(file, "%s", str) != EOF) {
//doubles the word_alloc/str_array if we have more words than allocated
if(ThreadData.word_count >= ThreadData.word_alloc) {
ThreadData.word_alloc *= 2;
ThreadData.str_array =(char **) realloc(ThreadData.str_array, sizeof(char*) * ThreadData.word_alloc);
}
ThreadData.str_array[ThreadData.word_count] = (char *) malloc(sizeof(char) * (strlen(str) + 1));
strcpy(ThreadData.str_array[ThreadData.word_count], str);
++ThreadData.word_count;
}