double pointer to constant array

You can create an array of pointers to each row of your 2D array:

double *A_const_p[] = { A_const[0], A_const[1], 
                        A_const[2], A_const[3], 
                        A_const[4], A_const[5], A_const[6]};

Then you can pass this array to MatrixMult.

Note however that you’ll need to remove the const qualifier from A_const if you don’t want to change the function definition.

You also can’t change the function to accept a const double ** because a double ** cannot be passed in for this parameter. See this question for details.

Leave a Comment