diff options
-rw-r--r-- | wk5/pset/speller/dictionary.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/wk5/pset/speller/dictionary.c b/wk5/pset/speller/dictionary.c index cd393dc..c478f2f 100644 --- a/wk5/pset/speller/dictionary.c +++ b/wk5/pset/speller/dictionary.c @@ -49,11 +49,11 @@ unsigned int hash(const char *word) { // (sum of (letter - 'A') % 26) of a word to get a value of where to store it in the hash table int val = 0; - for (int i = 0; word[i] != ; i++) + for (int i = 0; word[i] != '\0'; i++) { val += (word[i] % 26); } - return word[0] % 26; + return val % 26; } // Loads dictionary into memory, returning true if successful, else false |