So I am currently working on Pset4 speller and implementing it using hastable. I have written the load() function but I am not sure if it's correct as you need to compile speller.c and not dictionary.c, is there a way to know whether the function works as I would like to be sure that my load() function works before proceeding ahead.
// Buffer for a word
char word[LENGTH + 1];
int x;
// Insert words into hash table
while (fscanf(file, "%s", word) != EOF)
{
//Create a newnode
node *newnode = malloc(sizeof(node));
if(newnode == NULL)
{
unload();
return false;
}
//Copy the word into newnode
strcpy(newnode->word,word);
//Use the hash function to check correct postion in hastable
x = hash(newnode->word);
//Add newnode to the hastable
newnode->next = hashtable[x];
hashtable[x] = newnode;
}