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 an
double calcSS(double tfpairexp[][max_ctrl_no][max_rep_no])
One solution is to change the function signature to,
double calcSS(double ***tfpairexp, int M, int N, int P);
where M, N and P are dimensions of the arrray!
Or you can pass the instance of your class itself. After all, you've made the dimensions public in your class. And if this function is a member function of the class, then you don't even need to pass anything; you can access them from the function itself like this:
double calcSS(double ***tfpairexp)
{
for(int i = 0 ; i < cchips ; i++ )
{
for(int j = 0 ; j < max_ctrl_no ; j++ )
{
for(int k = 0 ; k < max_rep_no ; k++ )
{
//access elements as tfpairexp[i][j][k]
}
}
}
}
You can see this answer if it solves your problem: using a function template