冒泡排序
1、实现思想
2、实现代码
1 #include <stdio.h>
2 void bulubulu_sort(int *array, int len)
3 {
4 int temp;
5 for (int i = 0; i < len - 1; i++)
6 {
7 for (int j = 0; j < len - 1; j++)
8 {
9 if (array[j] < array[j + 1])
10 {
11 temp = array[j];
12 array[j] = array[j + 1];
13 array[j + 1] = temp;
14 }
15 }
16 }
17 }
18 int main(void)
19 {
20 int array[] = {1, 2, 3, 4, 5, 6, 7};
21 int len = sizeof(array) / sizeof(array[0]);
22 bulubulu_sort(array, len);
23 for (int i = 0; i < len; i++)
24 {
25 printf("%d ", array[i]);
26 }
27 return 0;
28 }
29 /*
30 输出
31 ————————————————————————————
32 7 6 5 4 3 2 1
33 ————————————————————————————
34 */

![冒泡排序
[编程语言教程]](https://www.zixueka.com/wp-content/uploads/2024/01/1706715597-04be81014b0c99a.jpg)

