I am facing a problem in trying to fill a multidimensional array m[4][4][3][3]. These are actually 16 3x3 matrices that I already know, which I am trying to fill. What is the correct way to do this? I am getting an error :"16: expected primary-expression before '{' token"
Please help.
#include<iostream>
using namespace std;
int main()
{
int m[4][4][3][3];//0,1,2,3 HLUT
m[0][0]={1,0,1,
1,1,1,
1,0,1};
m[0][1]={1,1,1,
0,1,0,
1,1,1};
m[0][2]={1,0,1,
1,1,1,
1,0,1};
m[0][3]={1,1,1,
0,1,0,
1,1,1};
m[1][0]={1,0,0,
1,0,0,
1,1,1};
m[1][1]={0,0,1,
0,0,1,
1,1,1};
m[1][2]={1,1,1,
0,0,1,
0,0,1};
m[1][3]={1,1,1,
1,0,0,
1,0,0};
m[2][0]={1,0,1,
1,0,1,
1,1,1};
m[2][1]={1,1,1,
0,0,1,
1,1,1};
m[2][2]={1,1,1,
1,0,1,
1,0,1};
m[2][3]={1,1,1,
1,0,0,
1,1,1};
m[3][0]={1,1,1,
0,1,0,
0,1,0};
m[3][1]={1,0,0,
1,1,1,
1,0,0};
m[3][2]={0,1,0,
0,1,0,
1,1,1};
m[3][3]={0,0,1,
1,1,1,
0,0,1};
}
error C3863: array type 'int [3][3]' is not assignablem[0][0][0] = {1,1,1};and so on. You can also try using double braces withm[0][0] = {{1,0,1,1,1,1,1,0,1}};. I'm not near my compiler so I can't test it...