I have a function setPosition declared like:
void setPosition(char ***grid, int a, int b) {
int x = a / 8;
int xbit = a % 8;
int y = b;
(*grid)[x][y] |= 1 << xbit;
}
and in my main, I have:
char grid[1000][1000];
setPosition(&grid, 10, 5);
But I get “warning: passing argument 1 of ‘setPosition’ from incompatible pointer type”. why?
Arrays and pointers are not the same type, even though arrays do decay to pointers when passed to functions. You can change the method signature to take an array
but if you are doing C++,
vector<vector<char> >would provide a much better and more flexible option.