I'm trying to sort a vector of char using the selection method (Seletion Sort), but it's returning the vector exactly the same, without even making a change. Can someone point me to where the error is in the code?
void selectionSortChar(char v[][30], int max) {
int i, j, min;
char aux[30];
for (i = 0; i < (max - 1); i++) {
min = i;
for (j = i + 1; j < max; j++) {
if (stricmp(v[j], v[j + 1]) > 0) {
min = j;
}
}
if (i != min) {
strcpy(aux, v[j]);
strcpy(v[j], v[j + 1]);
strcpy(v[j + 1], aux);
}
}
mostraVetorChar(v, 6);
}