Cannot convert double [] [] to double **
c++, double
Solution
Use any of the following declarations. Both are equivalent.
NormalizeDataZeroMeanUnitSD(double trainingActions[][24], int numberOfTrainingActions, int descriptorDimension)
NormalizeDataZeroMeanUnitSD(double trainingActions[681][24], int numberOfTrainingActions, int descriptorDimension)
When you declare a 2D array it takes up contiguous memory locations. So you need to specify at least the number of columns (in case of row major architecture).
For row major and column major definitions, have a look at this.
For your edited question, yes you can declare using `**data`. Dynamically allocate the `data` array. But remember to free it when you're done with it.
double **data=new double*[681];
for (int i=0;i<681;i++)
{
data[i]=new double[24];
}
//do what you want to do
for (int i=0;i<681;i++)
{
delete [] data[i];
}
delete [] data;
Now your function prototype can be like `void func(double **pp)` because `data` is a pointer not a 2D array.
Problem
I ve got a function that takes 3 parameteres, first one is **double. ``` normalizeDataZeroMeanUnitSD(double ** trainingActions, int numberOfTrainingActions, int descriptorDimension) ``` When I call it from main, I am trying to use normalizeDataZeroMeanUnitSD(data, 681, 24); however, I am receiving ``` cannot convert parameter 1 from 'double [681][24]' to 'double **' ``` This is how I construct the data array: ``` fstream infile; infile.open("gabor\\Data.txt"); double data[681][24]; while (!infile.eof()) { for(int j=0;j<681;j++) { for(int k=0; k<24;k++) { infile >> data[j][k]; } } } infile.close(); ``` Is there a way to do the same using **data?