Hi,

Anyone could help me how to use pointer notation when passing multidimensional arrays?

I got an error C2664: 'yield' : cannot convert parameter 1 from 'double [3][4]' to 'double *[][4]' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast. I am using MS Visual C++ Compiler.


#include <iostream>
using namespace std;

double yield(double* hello[][4], int x);

double array[3][4] = {
{1.5, 2.6, 4.2, 4.3},
{7.3, 6.2, 9.7, 5.2},
{1.3, 8.5, 9.7, 4.8}
};

int main()
{
cout << "Total = " << yield(array, sizeof array / sizeof array[0]) <<endl;
return 0;
}

double yield(double* values[][4], int count)
{
double sum = 0.0;
for (int i=0; i < count ; i++)
for(int j=0; j<4; j++)
sum += *values[i][j];
return sum;
}


Thank in advance.

gogo