C implementation of heapsort.