EDIT : This is all done in C.
Let's say I have the two following arrays :
int numFields[] = {5, 1, 3, 2, 7}
char charFields[] = {'a' , 'b', 'c', 'd', 'e'}
I want to sort numFields numerically and have charFields resorted to match the new order of numFields such that :
int numFields[] = {1, 2, 3, 5, 7}
char charFields[] = {'b', 'd', 'c', 'a', 'e'}
I know that is possible to use qsort to sort numFields numerically, but is it possible to sort charFields to match the index changes of numFields? Is there a built in function or do I have to make my own implementation?
Thanks
numFieldsbut swaps bothnumFieldsandcharFieldsitems. The other one would be rebuilding data to the array of structs{ int num; char ch;}, then compare onlynumfiled of struct. Thera are more...