#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main(void)
{
int arr[4] = { 1,3,2,'\0' };//加上'\0'后由数组变成字符串
int i, j, temp;
for (i = 0; i < 2; i++)
{
for (j = 0; j < 3 - i - 1; j++)
{
if (arr[j] > arr[j + 1])//单增还是单减
{
temp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = temp;
}
}
}
for (i = 0; i < 3; i++)//排好序了;随便定义未知数输出
{
printf("%d\n", arr[i]);
}
return 0;
}
标签:arr,SECURE,temp,int,冒泡排序,++ From: https://blog.51cto.com/u_16073189/6218560