I have been trying to figure Speller on my own but have been unable to.
My first problem in a list of never ending ones is this -
segmentation fault over this line of code
while (fscanf(dict, "%s", dictword) != EOF)
where dictword is initialised as such
char *dictword = "ha";
Now this initialisation to "ha" is a story of irony on its own.
I had to initialise it because later on in the code, the function line fscanf() needed the variable to be initialised to some value before accepting it as an input. But, the value could not be NULL as the function strcasecomp threw an error stating that the argurment needed the variable to not be initialised to NULL(even though the value clearly gets updated once I run the fscanf function over it)
I even tried to initialise dictword as
char dictword[LENGTH] but that was another surprise as the code suddenly went topsy turvy and returned a runtime error (along with the segmentation fault) with the following text
runtime error: member access within null pointer of type 'node' (aka 'struct _node')
which was on an entirely different line of code.
name this ->
hashtable[index] -> next = new_node;
Tbh, now I am slowly going crazy with this pset. Could really use some help. Here's the code for entire dictionary.c which might throw some light on my ailing problems.
Edit - The code works now thanks to the answer. The gist is now updated with the working code. You may view the revisions to look for the older version.