From a47deea615a95ab9b6badcb6f1ad02a64bdb6564 Mon Sep 17 00:00:00 2001 From: Fudgerboy <91767657+Fudgerboy@users.noreply.github.com> Date: Mon, 29 Apr 2024 05:21:11 +0000 Subject: Sun, Apr 28, 2024, 10:21 PM -07:00 --- wk5/pset/speller/dictionary.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'wk5/pset') diff --git a/wk5/pset/speller/dictionary.c b/wk5/pset/speller/dictionary.c index 7186765..96c3e80 100644 --- a/wk5/pset/speller/dictionary.c +++ b/wk5/pset/speller/dictionary.c @@ -5,6 +5,7 @@ #include #include #include +#include #include "dictionary.h" // Represents a node in a hash table @@ -30,19 +31,11 @@ bool check(const char *word) int val = hash(word); node *current = table[val]; - // buffer string becasue word is const - char *buff[strlen(word)]; - // make word lowercase - for (int i = 0; word[i] != '\0'; i++) - { - buff[i] = (tolower(word[i])); - } - // check all nodes in the bucket while (current != NULL) { // check if this is the word - if (strcmp(current->word, word) == 0) + if (strcasecmp(current->word, word) == 0) { return true; } -- cgit v1.2.3