I am trying to have a function change a 2D array that is part of another class, and I do not want to use a global variable.
My array contains actual values, but it is defined by
int cellGrid[101][101];
and the function I am trying to use looks like this
Cell::myCellFunction(int x, int y, int& cellGrid){
cellGrid[x][y]--;
}
I attempted to pass a reference to the array as a parameter, but when I tried to access the data, I get this error
./cellFunctions.cpp:277:13: error: subscripted value is not an array, pointer, or vector
cellGrid[x][y]--;}
~~~~~~~~^~
What is the best way to pass in a 2D array so that my function is able to change the actual array and not a copy?