void bubble_sort(unsigned int *array, unsigned int size) { unsigned int i = 0; unsigned int j = 0; unsigned int tmp = 0; for (i = size - 2; i >= 0; --i) { for (j = 0; j <= i; ++j) { if (array[j] > array[j + 1]) { tmp = array[j]; array[j] = array[j + 1]; array[j + 1] = tmp; } } } }
原文:http://www.cnblogs.com/barrychiao/p/3791972.html