summaryrefslogtreecommitdiff
path: root/wk5/pset
diff options
context:
space:
mode:
authorFudgerboy <91767657+Fudgerboy@users.noreply.github.com>2024-04-28 23:39:08 +0000
committerFudgerboy <91767657+Fudgerboy@users.noreply.github.com>2024-04-28 23:39:08 +0000
commit5a3bcf547b7766220bb819cccee80416c87e3e2d (patch)
treecb94e423a6a37545d286656f0efb36e367a62555 /wk5/pset
parentfbb38baa489ccd648d05c381d5c94ed948c5a726 (diff)
Sun, Apr 28, 2024, 4:39 PM -07:00
Diffstat (limited to 'wk5/pset')
-rw-r--r--wk5/pset/speller/dictionary.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/wk5/pset/speller/dictionary.c b/wk5/pset/speller/dictionary.c
index 2cd5256..19be3d6 100644
--- a/wk5/pset/speller/dictionary.c
+++ b/wk5/pset/speller/dictionary.c
@@ -26,7 +26,7 @@ int size = 0;
bool check(const char *word)
{
// hash word to find bucket
- node *current = table(hash(word));
+ node *current = table[hash(word)];
// check all nodes in the bucket
while (current != NULL)
@@ -89,11 +89,11 @@ bool load(const char *dictionary)
// hash the word to find the bucket it goes in
int val = hash(word);
// put new node at begining of bucket
- if (table(val)->next != NULL)
+ if (table[val]->next != NULL)
{
- ptr->next = table(val)->next;
+ ptr->next = table[val]->next;
}
- table(val)->next = *ptr;
+ table[val]->next = *ptr;
}
// Close the dictionary file
@@ -114,7 +114,7 @@ bool unload(void)
for (int i = 0; i < N; i++)
{
// while there's more in the bucket
- node *current = table;
+ node *current = table[i];
while (current != NULL)
{
// record position of this node