void bubble(int *arr,int n)
{
for (int i = 1; i <= n - 1; i++)
{
int flag = 1;
for (int j = 1; j <= n - i; j++)
{
if (arr[j] > arr[j + 1])
{
int temp;
temp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = temp;
flag = 0;
}
}
if (flag == 1)
break;
}
}
数组从下表为1开始!!!(不良嗜好)
标签:arr,temp,int,void,冒泡排序,flag From: https://www.cnblogs.com/zeeeero/p/17822948.html