Skip to content

Instantly share code, notes, and snippets.

/dictionary.c

Created Mar 13, 2016
Embed
What would you like to do?
load
bool check(const char* word)
{
// create a cursor to iterate through the linked list
node* cursor = hashtable[hash(word)];
// transverse through the list
while (cursor)// -> next != NULL)
{
// if equal non case sensive
if(strcmp(cursor -> word, word) == 0 ||
strcmp(cursor -> word, word) == 32 ||
strcmp(cursor -> word, word) == -32)
{
// word found
return true;
}
// if they don't match, try the next one in the list
else
{
// try next word
cursor = cursor -> next;
}
}
// if it ever equals NULL, the list has ended and the word couldn't be found
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment