I am having trouble inputting a 3D array as an argument to a function in c++. I took out a lot of the code, leaving the minimum amount to get what is going on. The error I am getting is:
"no matching function for call to 'spatial_correlation'
spatial_correlation(Lattice, L, S, D, distances, types, space_corr);
^~~~~~~~~~~~~~~~~~~"
"note: candidate function not viable: no known conversion from 'float [4][4][D]' to 'float (*)[4][D]' for 7th argument
void spatial_correlation(char Lattice[S], const int L, const int S, const int D, vector<float> distances,"
#include <vector>
const int L = 10;
const int S = L*L;
void spatial_correlation(char Lattice[S], const int L, const int S, const int D,
vector<float> distances, char types[4], float space_corr[4][4][D])
{
//Finds the spatial correlation. Code not relevant
}
int main()
{
char types[4] = {'A','B','C','D'};
vector<float> distances;
get_distances(Lattice, L, S, distances);
const int D = distances.size();
float space_corr[4][4][D];
spatial_correlation(Lattice, L, S, D, distances, types, space_corr);
return 0;
}