Hi,
I can't figure out what's wrong with this code, but the selection sort isn't doing it's job (nothing gets sorted). I think there's probably a lot wrong with it, but I can't narrow it down. Everything else works. But I think the bottom line is that I'm not sure how to make selection sort work when it's an array of strings involved.
Here's the selection sort part:
Code:
char array[NUM][LEN] = {0};
int x, y, index_of_min;
int temp;
for (x=0; x<LEN-1; x++)
{
int index_of_min = x;
for(y=x; y<LEN; y++)
{
if(array[index_of_min]>array[y])
{
index_of_min = y;
}
}
}
temp = *array[x];
*array[x] = *array[index_of_min];
*array[index_of_min] = temp;
}