From c9b6b9a5ca082fe7c1b6f58d7713f785a9eb6a5c Mon Sep 17 00:00:00 2001 From: Martial Simon Date: Mon, 15 Sep 2025 01:08:27 +0200 Subject: add: graphs et rushs --- graphs/piscine/heap/create.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 graphs/piscine/heap/create.c (limited to 'graphs/piscine/heap/create.c') diff --git a/graphs/piscine/heap/create.c b/graphs/piscine/heap/create.c new file mode 100644 index 0000000..f0675ad --- /dev/null +++ b/graphs/piscine/heap/create.c @@ -0,0 +1,19 @@ +#include + +#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; +} -- cgit v1.2.3