0

Hello,

I want to sort a 2dim array by columns, but there is an error in my code. It doesn't accept value of element from 2dim array into C[x]. Can anybody help please?

```
static int counting_sortx( int** A[], int** B[], int k, int rows, int col){
/*Array A[ ] stores the initial data to be sorted.
Array B[ ] is used to store the final, sorted, list.
Array C[ ] is used to count the occurrences of the data values
*/
int i,j,C[k], T[rows];
//The first for loop initialises C[] to zero.
for (i=0; i<k; i++)
C[i] = 0;
//The second for loop increments the values in C[], according to their
//frequencies in the data.
for (j = 0; j < rows; j++)
int x=[j][col];
C[x] = C[x] + 1;
//The third for loop adds all previous values, making C[] contain a cumulative
//total.
for (i = 1; i < k; i++)
C[i] = C[i] + C[i-1];
//The fourth for loop writes out the sorted data into array B[].
for (j = 0; j < rows; j++){
B[C[A[j][col]]] = A[j][col];
C[A[j][col]] = C[A[j][col]] - 1;}
return 0;
};
```