TL;DR: your code is ill-formed.
Your compiler accepts some ill-formed parts of your code as an extension,
but that in turn triggers other ill-formed constructs.
Your code included the following line:
const int g = 20;
Later, in the main
function, your code included the following line:
int g;
The latter shadows the former.
Then you attempted to declare an array:
bool MatriceA[g][g];
In C++,
the dimension of an array shall be a constant expression.
Here, g
is a variable that is not a constant expression.
Variable-length arrays are not permitted in C++.
Therefore,
your code is ill-formed.
Since you are using the Dev-C++ IDE,
you are probably using the GCC compiler.
GCC accepts variable-length arrays as an extension.
But then, you code doesn't compile either.
Your functions accept bool MatriceA[g][g]
as a function parameter.
At that time, const int g = 20;
is in effect.
Therefore, your function parameter is really bool MatriceA[20][20]
,
which is really bool (*MatriceA)[20]
because of function parameter decay
(see the Stack Overflow question What is array decaying?).
Then you are calling the function with a variable-length array.
This is not allowed.
Therefore, your code is rejected.