diff options
author | dx <aryadevchavali1@gmail.com> | 2020-05-22 21:13:57 +0100 |
---|---|---|
committer | dx <aryadevchavali1@gmail.com> | 2020-05-22 21:13:57 +0100 |
commit | ed3c71373307909d20f0ea44adf06dc7e433bc6e (patch) | |
tree | 0d8f6ed21847978d1cc287d07d50f226446c0781 /Converter/src/array.c | |
parent | b8dc50fb1c784f909b116915f4f86013fa8a84ec (diff) | |
download | mdhtml-ed3c71373307909d20f0ea44adf06dc7e433bc6e.tar.gz mdhtml-ed3c71373307909d20f0ea44adf06dc7e433bc6e.tar.bz2 mdhtml-ed3c71373307909d20f0ea44adf06dc7e433bc6e.zip |
~array_init now uses pointer to an array pointer
This means that the pointer that I allocate can actually be used.
Diffstat (limited to 'Converter/src/array.c')
-rw-r--r-- | Converter/src/array.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Converter/src/array.c b/Converter/src/array.c index 442a4b5..650f31c 100644 --- a/Converter/src/array.c +++ b/Converter/src/array.c @@ -1,12 +1,12 @@ #include "../includes/array.h" #include <malloc.h> -void array_init(array_t *arr) +void array_init(array_t **arr) { - arr = malloc(sizeof(*arr)); - arr->sz_used = 0; - arr->sz_allocated = 8; - arr->data = malloc(arr->sz_allocated); + (*arr) = malloc(sizeof(*arr)); + (*arr)->sz_used = 0; + (*arr)->sz_allocated = 8; + (*arr)->data = malloc((*arr)->sz_allocated); } void array_append(array_t *arr, void *data) |