I declare a table of booleans and initialize it in main()
const int dim = 2;
bool Table[dim][dim];
int main(){
Table[dim][dim] = {{false,false},{true,false}};
// code
return 0;
}
I use mingw
compiler and the builder options are g++ -std=c++11
.
The error is
cannot convert brace-enclosed initializer list to 'bool' in assignment`
First, you are trying to assign a concrete element of array instead assigning the full array. Second, you can use initializer list only for initialization, and not for assignment.
Here is correct code:
bool Table = {{false,false},{true,false}};
Arrays can only be initialized like that on definition, you can't do it afterwards.
Either move the initialization to the definition, or initialize each entry manually.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With