Have you tried running with the small dictionary? Observe the "WORDS IN DICTIONARY" counts in the check50 report. If the word to check hashes to an empty index (which will not happen with the large dictionary) then this line cursor = cursor -> next; in check will seg fault. cursor is NULL, therefore cursor -> next doesn't exist.
At a glance, your problem potentially lies here:
char *word[LENGTH + 1];
The array size binds more tightly than *, so you are declaring an array of LENGTH + 1 pointers to a char, which you are also not allocating memory for.
Try simply declaring an array of chars:
char word[LENGTH + 1];
(And obviously remove the dereferencing operator where you pass word ...
I would recommend forgoing all the overhead of allocating new memory on every call to hash().
Instead, consider just looping through word and replacing c with tolower(word[i]) in your hash calculation.
Edit: as mentioned in another comment, the reason your free() fails is because you use the ++ increment operator to step through lowercaseword. While pointer ...
The random values you see in word is the result of previous iterations of the loop assigning longer words than the current one. It's not an issue per se since the functions handling it (such as strlen or strcpy) will just read to the first null terminator anyway.
The problem lies in the hash function, and actually took me a little while to figure out. It's ...
That free statement only executes if the word is spelled wrong. If spelled correctly, the return true statement executes and the free() call is not executed.
Two possible fixes.
You could add a free statement just before the return true statement.
Or, instead of using a node pointer and allocating memory to it, just create a node variable and use it. This ...
Perhaps its because table is being reinitialized with every word processed in the while loop? This will result in only the last word's index pointer being left in the array.
The table array needs to be initialized once. It should be done before the while loop starts, not inside the while loop.
As for the seg fault, well, that may be related to something ...