From 98852464c7d4cd3a6a08d0208378506fdce822d6 Mon Sep 17 00:00:00 2001 From: Katharina Fey Date: Sun, 14 Jul 2019 02:13:13 +0100 Subject: Adding a hashmap example --- examples/hash.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 examples/hash.c (limited to 'examples') diff --git a/examples/hash.c b/examples/hash.c new file mode 100644 index 0000000..7a06bbe --- /dev/null +++ b/examples/hash.c @@ -0,0 +1,23 @@ +#include + +int main() +{ + + // Root node which contains a list + struct bowl *root; + bowl_malloc(&root, HASH); + + struct bowl *a; + data_malloc(&a, LITERAL, "Destroy capitalism"); + bowl_insert_key(root, "a", a); + + struct bowl *b; + data_malloc(&b, INTEGER, 1312); + bowl_insert_key(root, "b", b); + + struct bowl *c; + data_malloc(&c, LITERAL, "Alerta, Antifascista!"); + bowl_insert_key(root, "c", c); + + return bowl_free(root); +} -- cgit v1.2.3