Ok, I honestly have exausted my mind over this one.
I have an array of 12 structures, each one has a name and several other double variables.
I am trying to sort the entries in the structure based on the value of one of those double variables. The one with the largest value ending up at the top.
If anyone has any suggestions for how I could go about it, im not looking for a code reply or 100% but more of a hard shove in the right direction
Currently I have defined a structure called holder to be a temporary place to move a position in the array of structures to.
I have also made an array of 1 of this structure so I can simply refer to it as holder[pos].name, .p etc.
just to explain before the code, .name is a character array.
.t is a double. This is the value I want to sort by.
holders is the array of holder structure, my temporary structure.
cars is the main structure I want to sort, cars is an array of car structures.
int pos = 0;
holders[pos].t = cars[i].t;
carss[i].t = cars[i+1].t;
cars[i+1].t = holders[pos].t;