diff options
author | Fudgerboy <91767657+Fudgerboy@users.noreply.github.com> | 2024-04-29 05:22:25 +0000 |
---|---|---|
committer | Fudgerboy <91767657+Fudgerboy@users.noreply.github.com> | 2024-04-29 05:22:25 +0000 |
commit | 144794c059e0b6fe64858cb304bfab3b475b9ba3 (patch) | |
tree | 5a64734e60ee6c9e8da103420e03b81f40dad88e /wk5/pset/speller | |
parent | a47deea615a95ab9b6badcb6f1ad02a64bdb6564 (diff) |
Sun, Apr 28, 2024, 10:22 PM -07:00
Diffstat (limited to 'wk5/pset/speller')
-rw-r--r-- | wk5/pset/speller/dictionary.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/wk5/pset/speller/dictionary.c b/wk5/pset/speller/dictionary.c index 96c3e80..36bf274 100644 --- a/wk5/pset/speller/dictionary.c +++ b/wk5/pset/speller/dictionary.c @@ -1,12 +1,12 @@ // Implements a dictionary's functionality +#include "dictionary.h" #include <ctype.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <strings.h> -#include "dictionary.h" // Represents a node in a hash table typedef struct node @@ -55,7 +55,8 @@ unsigned int hash(const char *word) bool load(const char *dictionary) { // initialize the table - for (int i = 0; i < N; i++) { + for (int i = 0; i < N; i++) + { // malloc size of next table[i] = NULL; } @@ -67,11 +68,11 @@ bool load(const char *dictionary) return false; } - //read each word in dictionary + // read each word in dictionary char word[LENGTH + 1]; // use fscanf(file, "%s", word) to grab words // check for ended file - while(fscanf(source, "%s", word) == 1) + while (fscanf(source, "%s", word) == 1) { // update size int siz++; @@ -103,7 +104,6 @@ bool load(const char *dictionary) ptr->next = table[val]; table[val] = ptr; } - } // Close the dictionary file |