Sounds like you need to just index it. Make an array that will hold the same number of elements as you have structures.
"Sort" the list of structures by using a simple array of integers to reference the individual structures. Example:
Code:
foo[0].name is "Joe"
foo[1].name is "Bob"
foo[2].name is "Sue"
Thus, your sorted index would be:
Code:
int index[3];
index[0] = 1;
index[1] = 0;
index[2] = 2;
Then you do something nifty like:
Code:
void displaysortedlist( struct foo list[], int index[] )
{
int x = 0;
for( x = 0; x < TOTAL; x++ )
printf("Name %d is %s\n", x, list[ index[x] ].name );
}
Nice and easy. Or you could just actually sort your array of stuctures. Or you could use an array of pointers to structures, and sort that.
Probably best to pick whatever it is your assignment requires hoever.
Quzah.