Sorting algorithms/Bubble sort: Difference between revisions

(→‎{{header|C}}: there is no point in making a local variable const)
Line 227:
=={{header|C}}==
<lang c>void bubble_sort(int *a, int n) {
int i, j, t = 1;
forwhile (i = n - 1; i- && t; i--) {
for (j = t = 0; j < in; j++) {
if (a[j] <= a[j + 1]) continue;
t = a[j];, a[j] = a[j + 1];, a[j + 1] = t;
 
t = 1;
t = a[j]; a[j] = a[j + 1]; a[j + 1] = t;
t = 1;
}
}
}
 
Anonymous user