Sorting algorithms/Quicksort: Difference between revisions

m
→‎{{header|C}}: Remove the comment about the bug in the prior version. Move swap and increment to their own lines.
m (→‎{{header|ooRexx}}: correct output tag)
m (→‎{{header|C}}: Remove the comment about the bug in the prior version. Move swap and increment to their own lines.)
Line 651:
if (*l < p) {
l++;
continue;
}
else if (*r > p) {
continuer--;
*r-- = t;}
*l++else = *r;{
int t = *l;
*l = *r;
*r = t;
l++;
r--;
continue; // we need to check the condition (l <= r) every time we change the value of l or r
}
int t = *l;
*l++ = *r;
*r-- = t;
}
quick_sort(a, r - a + 1);
quick_sort(l, a + n - l);
}
 
int main () {
int a[] = {4, 65, 2, -31, 0, 99, 2, 83, 782, 1};