I've found a few pointers which might be of use for you.
First the
theory in heap trees
Then two implementations
1;
2 in C++
Then an
example in C
These might no be, exactly what you're looking for, but it should give you a clear view on how you want to implement it.