Skip to content
Snippets Groups Projects
Commit 6b8cd21b authored by Lenitra's avatar Lenitra
Browse files

1010111

parent 47c35c61
No related branches found
No related tags found
No related merge requests found
......@@ -17,6 +17,16 @@ typedef struct hash_tbl* hash_tbl;
hash_tbl htbl_empty(size_t (*h)(void*),
int (*eq)(void*, void*),
void (*free)(void*)){
hash_tbl htbl = malloc(sizeof(*htbl));
htbl->h = h;
htbl->eq = eq;
htbl->free = free;
htbl->size = 0;
htbl->capacity = ARRAY_CAPACITY;
htbl->array = malloc(sizeof(*htbl->array) * htbl->capacity);
for (size_t i = 0; i < htbl->capacity; i++)
htbl->array[i] = list_empty();
return htbl;
}
int htbl_add(hash_tbl htbl, void* x){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment