diff options
| author | Kai Stevenson <kai@kaistevenson.com> | 2023-02-14 02:02:50 -0800 |
|---|---|---|
| committer | Kai Stevenson <kai@kaistevenson.com> | 2023-02-14 02:02:50 -0800 |
| commit | 24f981233bc3e0b000acf4615d4bc6f2332eefb0 (patch) | |
| tree | b036a7d937f8444d326355cbe07eea70df693c59 /hashtable.h | |
init
Diffstat (limited to 'hashtable.h')
| -rw-r--r-- | hashtable.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/hashtable.h b/hashtable.h new file mode 100644 index 0000000..be45964 --- /dev/null +++ b/hashtable.h @@ -0,0 +1,18 @@ +#ifndef HASHTABLE +#define HASHTABLE + +typedef struct HashPair { + char* key; + void* value; +} pair_t; +typedef struct HashTable { + pair_t** pairs; + int capacity; + int itemCount; +} hashtable_t; +unsigned int get_hash(char* str); +hashtable_t* init_hashtable(unsigned int capacity); +unsigned int hashtable_add_pair(hashtable_t* hashtable, pair_t pair); +pair_t* hashtable_get_pair(hashtable_t* hashtable, char* key); + +#endif |
