C implementation of priority queue based on dynamic array