#include <stdio.h>
#include <stdbool.h>
void show(int A[],int n)
{
for(int i = 0;i<n;i++)
{
printf("%d\n",A[i]);
}
}
void BubbleSort(int A[],int n)
{
int i,j;
for(i = 0; i<n-1;i++)
{
for(j=0;j<n-1-i;j++)
{
if(A[j]>A[j+1])
{
int temp;
temp = A[j];
A[j]=A[j+1];
A[j+1]=temp;
}
}
}
}
int main()
{
int A[5];
A[1]=4,A[2]=3,A[3]=1,A[0]=2;
BubbleSort(A,4);
show(A,4);
return 0;
}
01-31
2003
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
08-10
5903
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
09-19
262
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
04-18
416
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
02-11
6177
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)