I have looked through the forums for a problem similar to mine but given the specifics of my particular assignment, none of the posts (that I've seen so far) have similar structures.
I have an array of a given length... in this case, we'll say:
input[5];
using a function named larger(a, b) in another.c file, which determines which of two ints is larger, how do I sort the elements of an array in ascending order? I've been sitting here for hours messing with it but I keep confusing myself.
This is what I have so far, which is way off, but just to show you the code structure for this part of the code.
Code:
for(j = total; j > 0; j--) /* total is the length of the array */
{
for(i = 0; i < j; i++)
{
temp = larger(input[i], input[j]);
if(temp = input[i])
{
temp1 = input[j];
input[j] = input[i];
input[i] = temp1;
}
}
}
Thank you in advance for taking time to look at this.