-
Notifications
You must be signed in to change notification settings - Fork 0
/
6-main.c
40 lines (38 loc) · 964 Bytes
/
6-main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "hash_tables.h"
/**
* main - check the code
*
* Return: Always EXIT_SUCCESS.
*/
int main(void)
{
hash_table_t *ht;
char *key;
char *value;
ht = hash_table_create(1024);
hash_table_set(ht, "c", "fun");
hash_table_set(ht, "python", "awesome");
hash_table_set(ht, "Bob", "and Kris love asm");
hash_table_set(ht, "N", "queens");
hash_table_set(ht, "Asterix", "Obelix");
hash_table_set(ht, "Betty", "Cool");
hash_table_set(ht, "98", "Battery Streetz");
key = strdup("Tim");
value = strdup("Britton");
hash_table_set(ht, key, value);
key[0] = '\0';
value[0] = '\0';
free(key);
free(value);
hash_table_set(ht, "98", "Battery Street");
hash_table_set(ht, "hetairas", "Bob");
hash_table_set(ht, "hetairas", "Bob Z");
hash_table_set(ht, "mentioner", "Bob");
hash_table_set(ht, "hetairas", "Bob Z Chu");
hash_table_print(ht);
hash_table_delete(ht);
return (EXIT_SUCCESS);
}