my problem is the next (is an easy example to show the problem):
I have:
int* array1;
double* array2.
array1=new int[10];
array2=new double[10];
array1=filledWithIntegers(random);
array2=filledWithDoubles(random);
//Here I want to sort array1 based on array2 values. I´m trying to use qsort function of stdlib. qsort(array1,6, sizeof(int), compare);
The point is how to make the compare function for order array1 based on array2.
It is not possible to use std library data structures, it must be done directly in the array pointers.
Thanks.
compare
should return-1
(instead of0
) when smaller. – Darees