Cannot convert Brace-enclosed initializer list Cannot convert Brace-enclosed initializer list arrays arrays

Cannot convert Brace-enclosed initializer list


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.


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}};


You can use memset(Table,false,sizeof(Table)) for this.it will work fine.

Here is your complete code

#include <iostream>#include<cstring>using namespace std;   const int dim = 2;    bool Table[dim][dim];    int main(){         memset(Table,true,sizeof(Table));         cout<<Table[1][0];// code    return 0;    }