Guys, i'm working on a bubble sort and its only resulting in a semi sorted list. Long file names are not being sorted properly.
for (l = 0; l < entry_nr; l++) { for (j = 0; j < entry_nr - 1; j++) { // compare strings if (strcmp(data[j].strings[j], data[j + 1].strings[j + 1]) > 0) { strcpy(temp, data[j].strings[j]); strcpy(data[j].strings[j], data[j + 1].strings[j + 1]); strcpy(data[j + 1].strings[j + 1], temp); } } }
The Bubble sort results in a sorted list but long file names are not sorted properly. See below: