heap implementation in c