I have a array of structs. lets call it structsarray
And i have a array of ints where the ints are index’s of the stuct. Lets call it indexarray
I would like to sort indexarray but i want to compare the sorting with an int in structsarray
Any way that can be done with that setup?
You have a comparison function such as this:
The arguments are pointer to the values in the array you are sorting. I cast the constant void pointer to a constant int pointer, and then dereference that pointer to get the actual value.