passing multidimensional arrays to function

Posted by Pegah on Stack Overflow See other posts from Stack Overflow or by Pegah
Published on 2011-01-13T17:19:19Z Indexed on 2011/01/13 17:53 UTC
Read the original article Hit count: 192

Filed under:

hi! I have a method in my class which uses a 3dimensional tfpairexp as input parameter. and I need to use the values in tfpairexp later.

void calctfpairexp (int tf1, int tf2, double tfpairexp[][2][3]) 
{

    int ctr,c;
    for (int j = 0; j < cchips && (c = chips[j].crepls); j += c)
    {
        int ctrl_no=0;
        for (int *p = chips[j].ctrl ; p && (ctr=*p)>=0; ++p,ctrl_no++)  {

            for (int k = 0; k < c; ++k)
            {

                tfpairexp[j][ctrl_no][k]=interactionFunc(2,3,1);
            }
        }
    }

}

I call the method inside the class like this: calctfpairexp(tf1,tf2,tfpairexp); and I need to use values inside tfpairexp in next lines. but the compiler gives error in this line:

tfpairexp[j][ctrl_no][k]=interactionFunc(2,3,1);

and says that the tfpairexp variable is not defined in the calctfpairexp function. any idea?

© Stack Overflow or respective owner

Related posts about c++