Hashmap
This commit is contained in:
parent
77a8a6bb74
commit
5274372180
4 changed files with 160 additions and 0 deletions
23
hashmap/main.c
Normal file
23
hashmap/main.c
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#include "hashmap.h"
|
||||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
hashmap_t *map = hashmap_create(128);
|
||||
|
||||
int value1 = 42;
|
||||
hashmap_put(map, "answer", &value1);
|
||||
|
||||
int *found = hashmap_get(map, "answer");
|
||||
if (found) {
|
||||
printf("Found: %d\n", *found);
|
||||
}
|
||||
|
||||
hashmap_remove(map, "answer");
|
||||
found = hashmap_get(map, "answer");
|
||||
if (!found) {
|
||||
printf("Entry removed.\n");
|
||||
}
|
||||
|
||||
hashmap_destroy(map);
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue