Anonymous user
Sorting algorithms/Insertion sort: Difference between revisions
→{{header|C}}: Remove print_array function
(→{{header|C}}: use t for temporary variable to fit in with the other C examples) |
(→{{header|C}}: Remove print_array function) |
||
Line 237:
a[j] = t;
}
}▼
for (i = 0; i < n; i++) {▼
printf(" %d", a[i]);▼
}
Line 250 ⟶ 242:
int a[] = {4, 65, 2, -31, 0, 99, 2, 83, 782, 1};
int n = sizeof a / sizeof a[0];
insertion_sort(a, n);
printf("%d%s", a[i], i == n - 1 ? "\n" : " ");
return 0;
▲}
{{out}}
<pre>
</pre>
|