You cannot do this extractMin(VertexPointer *heap, int &heap_size)
in C
- change it to extractMin(VertexPointer *heap, int *heap_size)
There is no Pass-by-reference in C. So you should have something like this:
extractMin(VertexPointer *heap, int *heap_size){
VertexPointer max = heap[0];
(*heap[0]).key = 100;
*heap_size = *heap_size - 1;
minHeapify(heap, *heap_size, 1);
return max;
}
The &
is used to get the address of the variable so when calling the function you should call it this way:
extractMin(someAddress_to_heap, someAddress_to_heap_size)