summaryrefslogtreecommitdiff
path: root/comp/lucas-standen-NEA/code/ads/dict/dict.c
diff options
context:
space:
mode:
authorstandenboy <standenboy@seacrossedlovers.xyz>2024-04-30 14:22:45 +0100
committerstandenboy <standenboy@seacrossedlovers.xyz>2024-04-30 14:22:45 +0100
commitc460a26850eca5ded047d0eb0d183b861087aa53 (patch)
tree000c4a117746de71870fbee820809f7df49bcfcf /comp/lucas-standen-NEA/code/ads/dict/dict.c
parent2e239a4ed2265f7c7dc2aabedfdb7d7b011704cb (diff)
write up update
Diffstat (limited to 'comp/lucas-standen-NEA/code/ads/dict/dict.c')
-rw-r--r--comp/lucas-standen-NEA/code/ads/dict/dict.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/comp/lucas-standen-NEA/code/ads/dict/dict.c b/comp/lucas-standen-NEA/code/ads/dict/dict.c
new file mode 100644
index 0000000..551afca
--- /dev/null
+++ b/comp/lucas-standen-NEA/code/ads/dict/dict.c
@@ -0,0 +1,29 @@
+#include <stdlib.h>
+#include <string.h>
+
+typedef struct dict_t {
+ int id;
+ void *data;
+}dict_t;
+
+dict_t *dictalloc(){
+ dict_t *output = malloc(sizeof(dict_t));
+ return output;
+}
+
+int dictset(dict_t *dict, int id, void *data){
+ dict->id = id;
+
+ dict->data = malloc(sizeof(data));
+ if (dict->data == NULL)
+ return 1;
+ memcpy(dict->data, data, sizeof(data));
+
+ return 0;
+}
+
+void dictfree(dict_t *dict){
+ free(dict->data);
+ free(dict);
+}
+