From 2e239a4ed2265f7c7dc2aabedfdb7d7b011704cb Mon Sep 17 00:00:00 2001 From: standenboy Date: Thu, 25 Apr 2024 08:54:44 +0100 Subject: dll wasn't working and prob wasn't needed so i removed it --- comp/cw/code/ads/dict/dict.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 comp/cw/code/ads/dict/dict.c (limited to 'comp/cw/code/ads/dict/dict.c') diff --git a/comp/cw/code/ads/dict/dict.c b/comp/cw/code/ads/dict/dict.c new file mode 100644 index 0000000..551afca --- /dev/null +++ b/comp/cw/code/ads/dict/dict.c @@ -0,0 +1,29 @@ +#include +#include + +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); +} + -- cgit v1.2.3