aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorKatharina Fey <kookie@spacekookie.de>2019-07-14 02:13:13 +0100
committerKatharina Fey <kookie@spacekookie.de>2019-07-14 18:47:18 +0100
commit98852464c7d4cd3a6a08d0208378506fdce822d6 (patch)
tree6a4a0a913ee55f7776fa0c5dd5c0544567f877af /examples
parentc312e74f95fcfe9bd1e91c092a2d987cb067a075 (diff)
Adding a hashmap example
Diffstat (limited to 'examples')
-rw-r--r--examples/hash.c23
1 files changed, 23 insertions, 0 deletions
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 <bowl.h>
+
+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);
+}