Heap implementation in C