void quick_sort(struct student *students, int low, int high) { int index_low, index_high; if (low < high) { for (index_low = low, index_high = high; index_low <= index_high;) { if (students[index_low].score >= students[low].score) index_low++; else if (students[index_high].score < students[low].score) index_high--; else { swapstr(students, index_low, index_high); swap_score(students, index_low, index_high); } } if (students[index_high].score > students[low].score) { swapstr(students, index_high, low); swap_score(students, index_high, low); } quick_sort(students, low, index_high - 1); quick_sort(students, index_high + 1, high); } }
void strswap(void) { int times = 0x10,i; for(i = 0; i < times;i++) { prints(" .....before.....\n"); prints(" str1=%s\n str2=%s\n", str1, str2); swapstr(str1, str2); prints(" .....after.....\n"); prints(" str1=%s\n str2=%s\n", str1, str2); } }