summaryrefslogtreecommitdiff
path: root/graphs/piscine/heap/create.c
blob: f0675ad9c48744aab2094a7d1c5255afbc296054 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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;
}