Solved all problems:
reachable memory - in linked list added a new item in the end:
iterate to the last item in list (not to null, but the last which
allocate memory for new word in the list, add the word, and next -> null
free temporary node
also met with some errors, like:
==1281== HEAP SUMMARY:
==1281== in use at exit: 0 ...
For starters, the program doesn't actually compile without error. It's probably compiling in your environment with a warning about an unused parameter in the call to load().
In most people's environment, that would produce a warning about the unused parameter of dictionary in the signature which would be treated as an error.
The root cause of that is this ...
on observing the check 50 and debug50 results, I realized that the problem was in the unload function. solution:
// Unloads dictionary from memory, returning true if successful, else false
node *tmp = NULL;
node *cursor = NULL;
//iterating over each linked list in the hash table.
for(int i = 0; i < N; ...
The first big problems I see are in check(). Look at this line:
while(cursor->next != NULL)
This is going to result in every other node being skipped, among other anomalies. It should be checking cursor, not cursor->next. I'll let you figure out why. Next, there's the two free(cursor) statements in the check function. Even though you created a ...
It looks like an intermittent problem that's going to rear it's ugly head depending on what's in memory and what was in memory before.
Since your whole code wasn't posted, I looked fairly closely at the load function. This jumps out at me:
for (int i = 0; word[i]; i++)
w->word[i] = word[i];
It looks like the code is trying to ...