heap data structure implementation in C