diff options
Diffstat (limited to 'rushs/tinyprintf/heap/create.c')
| -rw-r--r-- | rushs/tinyprintf/heap/create.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/rushs/tinyprintf/heap/create.c b/rushs/tinyprintf/heap/create.c new file mode 100644 index 0000000..f0675ad --- /dev/null +++ b/rushs/tinyprintf/heap/create.c @@ -0,0 +1,19 @@ +#include <stdlib.h> + +#include "heap.h" + +struct heap *create_heap(void) +{ + struct heap *res = malloc(sizeof(struct heap)); + if (res == NULL) + return NULL; + res->size = 0; + res->capacity = 8; + res->array = malloc(8 * sizeof(int)); + if (res->array == NULL) + { + free(res); + return NULL; + } + return res; +} |
