无论是多少维的数组,机内都是一维的,以行优先存放。所以直接降为一维数组排序最方便省事。下面以二维数组为例写出代码——include "stdio.h"int main(int argc,char *argv[]){int x[3][3]={{9,4,3},{6,2,7},{5,8,1}},i,j,k,*p;printf("Before ordering is as follows:\n");...
} }//qsort的cmp函数int cmp(const void*a, const void *b){ return *(int*)a-*(int*)b;}int main(int argc, char* argv){ int a[M][N]={3,2,1,9,8,7,6,5,4}; printf("按列排序前的二维数组是:\n"); print(a); printf("\n"); int j; for...