qsort: Sort 1 Dimension of 3D array in C -
i have 3d array: float input[2][50][1000];
i want quick sort from:
qsort (x, sizeof(x)/sizeof(*x), sizeof(*x), comp); where comp is
int comp (const void * elem1, const void * elem2) { float f = *((float*)elem1); float s = *((float*)elem2); if (f > s) return 1; if (f < s) return -1; return 0; } i want sort 1 dimension of 3d array, i.e want sort input[0][temp][0], input[0][temp][1], input[0][temp][2] , on.
ques: replace x with? forgive me if sounds stupid
float (*x)[1000] = &input[0][temp]; qsort (x, sizeof(*x)/sizeof(**x), sizeof(**x), comp);
Comments
Post a Comment