C implementation of Heap Sort