编辑代码

#include <stdio.h>
#define N 5
int main () {
    int a[N] = {3,2,1,4,5};
    for (int i = 0; i<N-1; i++) {
        int maxIdx = 0;
        for (int j=1; j<N-1-i; j++) {
            if (a[maxIdx] < a[j] ) {
                maxIdx = j;
            }
        }
        int tmp = a[maxIdx];
        a[maxIdx] = a[N-1-i];
        a[N-1-i] = tmp;
    }
    for (int i=0; i<N-1; i++) {
        printf("%d",)
    }
    return 0;
}