So I'm calling heapsort on an array in C.
My heapsort function looks like this:
void heapSort(int keys[], int numKeys){
...
int tmp[numKeys];
for(int i=0; i<numKeys; i++){
tmp[i] = maxVaue(h);
deleteMax(h);
}
*keys = tmp;
}
What I'm trying to do is change keys
to point to the new array, as the function return type is void. Is there any way to do this with pointers, or do I need to just memcpy
the array?