I have function like this:
void findScarf1(bool ** matrix, int m, int n, int radius, int connectivity);
and in main function I create 2d dynamic array to pass in this function
bool matrix[6][7] = {
{0, 0, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 0, 0},
{0, 0, 1, 1, 1, 0, 0}
};
The problem is:
findScarf1(matrix, 6, 7, 3, 4);
causes error C2664: 'findScarf1' : cannot convert parameter 1 from 'bool [6][7]' to 'bool **'
How to initialize array compactly(simultaneously with declaration)?
p.s. sorry if it's duplicate question but I've spent 1.5 hours figuring it out
See Question&Answers more detail:os