diff options
author | Fudgerboy <91767657+Fudgerboy@users.noreply.github.com> | 2024-04-29 05:21:11 +0000 |
---|---|---|
committer | Fudgerboy <91767657+Fudgerboy@users.noreply.github.com> | 2024-04-29 05:21:11 +0000 |
commit | a47deea615a95ab9b6badcb6f1ad02a64bdb6564 (patch) | |
tree | cb45e5bfebd827bd3179f0d873c382e216ebc659 /wk5/pset | |
parent | 9cf7c7f8e6adb924ae43d980ad5a14bd977e0948 (diff) |
Sun, Apr 28, 2024, 10:21 PM -07:00
Diffstat (limited to 'wk5/pset')
-rw-r--r-- | wk5/pset/speller/dictionary.c | 11 |
1 files changed, 2 insertions, 9 deletions
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 <stdio.h> #include <stdlib.h> #include <string.h> +#include <strings.h> #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; } |