Finding the next highest value in a int variable
I need a method or mechanism to find/sort the values stored in a struct member of type int. e.g proc[i].priority
How or what can i use to deal with the values stored in the variable, so that i can process them in an ascending order such as all the 0's first and all the 20's last ( 0 - 20 ).
I was thinking something like:
But i dont think this actually picks up the next number in the sequence and that it will choose any number up to 20, when i need it to choose all the 2 values stored in .priority first. then the 3's, 4's etc.
if ( proc[i].priority > previousproc[i].priority )
previousproc[i].priority = proc[i].priority;
If anyone could provide a suitable way about going about this it would be appreciated thanks