I have a code:
int main(int argc, char **argv)
{
double A[600][4], b[600], c[4] ;
j = rand_lp(600, &(A[0][0]), &(b[0]), &(c[0]), &(result[0]));
}
int rand_lp(int n, double *A, double *b, double *c, double *result)
{
permutation(n, A, b);
return 0;
}
void permutation(int n, double *A, double *b)
{
int i;
int k;
double tmp0, tmp1, tmp2, tmp3, tmpb;
for(i = n; i > 0; i--)
{
k = rand()%i;
tmp0 = A[i][0]; // error : subscripted value is neither array nor pointer nor vector
tmp1 = A[i][1];
tmp2 = A[i][2];
tmp3 = A[i][3];
tmpb = b[i];
A[i][0] = A[k][0];
A[i][1] = A[k][1];
A[i][2] = A[k][2];
A[i][3] = A[k][3];
b[i] = b[k];
A[k][0] = tmp0;
A[k][1] = tmp1;
A[k][2] = tmp2;
A[k][3] = tmp3;
b[k] = tmpb;
}
}
So de facto I need to shuffle a matrix, that's why I need access to all coefficents, by C doesn't suppot 2-dem arrays I read. I can't change the call and the arguments of the function "rand_lp". Any ideas?