#include <stdio.h>
void displayArr(int a[],int n){
int i;
for(i=0;i<n;i++){
printf("%d->",a[i]);
}
}
void main(){
int i,j,n,t;
int a[5] = {88,23,55,32,66};
n = sizeof(a)/sizeof(a[0]);
for(i=0;i<n;i++){
for(j=n-1;j>i;j--){
//if(a[i]>a[j]){//从小到大排序
if(a[i]<a[j]){//从大到小排序
t=a[i];
a[i] = a[j];
a[j] = t;
}
}
}
displayArr(a,n);
}
Data structure-inner sort-bubble sort (array implementation, C language, sequence table is the same)
Guess you like
Origin blog.csdn.net/qq_24130591/article/details/109732045
Ranking