/*★ 再起関数で SORT する 前田 稔 ★*/ #include #include #define MAX 100 //最大 DATA 件数 int t[MAX]; int w; //関数のプロトタイプ宣言 void sort(int t[], int n); void max(int t[], int n); void disp(int n) { int i; printf("\n"); for(i=0; i1) { max(t,n); sort(t,n-1); } } // t[n] の最大の値を一番後(t[n-1]) に格納する void max(int t[], int n) { if (n<2) return; max(t,n-1); if (t[n-2]>t[n-1]) { w= t[n-2]; t[n-2]= t[n-1]; t[n-1]= w; } }