Sorry if this is really easy to fix or a stupid question but I've only recently started programming.
So basicly in void main() I've declared a 2D array like so:
void main()
{
const int grid = 5;
array[grid][grid];
{
However I would like to pass this into a function like this:
void drawGrid(int grid, bool array[][])
{
}
This creates an error as the second parameter needs to have a number. But that's a problem since in main I declared my array using a variable.
void drawGrid(int grid, bool array[grid][grid])
{
}
Putting variables in the parameters does not work.
How do I go about passing the array to this function whilst using the int variable grid inside the parameters.
I have searched a lot and looked at answers from people who had similar problems to me but I just could not seem to figure out what to do specifically. Could anyone please show me how to fix the problem, I'd be incredibly greatful as I've been trying to work this out for almost two hours now. Thanks.