#include <stdio.h> #include <stdlib.h> void array_sort(int *a, int len) { int i, j, tmp; for (i = 0; i < len - 1; i++) { for (j = i + 1; j < len; j++) { if (a[i] > a[j]) { tmp = a[i]; a[i] = a[j]; a[j] = tmp; } } } for (i = 0; i < len; i++) { printf("%d ", a[i]); } system("pause"); } void main() { int a[] = { 1, 2, 4, 0, 2, 6, 5, 9 }, len = sizeof(a) / sizeof(a[0]);; array_sort(a, len); }