I have a function in my class which should get a multi-dimensional array. the problem is that the value of these dimensions is calculated in the class, using another function and is stored in some public variables. so all the other functions within the class can read the value stored in these vars. the definition of function is like this:
double calcSS(double tfpairexp[][max_ctrl_no][max_rep_no])
where max_ctrl_no
and max_rep_no
are those public
variables.
and I call the function like this:
calcSS(tfpairexp);
but the compiler gives error for the definition of the function. and if I put some constant numbers instead of those vars, there is no error. But I don't know the dimension when the program begins. what should I do?
Update
void tripleofgenes(int begind,int endind) {
for (int tf1=0; tf1<tfact; ++tf1)
{
for (int tf2=tf1+1; tf2<tfact; ++tf2)
{
double tfpairexp[cchips][max_ctrl_no][max_rep_no];
double w,d;
int ctrl_no;int c, ctr;
for (int j = 0; j < cchips ; j += c)
{
c = chips[j].crepls;
int ctrl_no=0;
for (int *p = chips[j].ctrl ; p && (ctr=*p)>=0; ++p,ctrl_no++) {
for (int k = 0; k < c; ++k)
{
double tf1exp=chips[k+j].vals[tf1].val-((chips[k+j].useextra) ? chips[ctr].extra[tf1] : chips[ctr].mean[tf1].val);
double tf2exp=chips[k+j].vals[tf2].val-((chips[k+j].useextra) ? chips[ctr].extra[tf2] : chips[ctr].mean[tf2].val);
tfpairexp[j][ctrl_no][k]=interactionFunc(tf1exp,tf2exp,1);
}
}
}
for (int tg=begind; tg<=endind; ++tg)
if (tf1!=tg){
calcSS(tfpairexp);
}
}
}
fclose(f);
}
double calcSS(double ***tfpairexp)
{
for (int row = 0; row <= 1 ; row++)
for (int col = 0; col <= 1 ; col++) {
int cond=0;
for (int j = 0; j < cchips; j += c) {
c = chips[j].crepls; // the number of replicants
int ctrl_no=0;
for (int *p = chips[j].ctrl; p && (ctr=*p)>=0; ++p,ctrl_no++) {
a = tfpairexp[j][ctrl_no][k];}
}
}
}
}