int t=4; int b=3; int e=5; range time =1..t; range bus=1..b; range ev=1..e; float soci[ev][bus][time]=[[[0.5,0.3,0.8,0.7], [0.5,0.3,0.8,0.7], [0.5,0.3,0.8,0.7]] [[0.5,0.3,0.8,0.7], [0.5,0.3,0.8,0.7], [0.5,0.3,0.8,0.7]] [ [0.5,0.3,0.8,0.7], [0.5,0.3,0.8,0.7], [0.5,0.3,0.8,0.7]] [ [0.5,0.3,0.8,0.7], [0.5,0.3,0.8,0.7], [0.5,0.3,0.8,0.7]] [ [0.5,0.3,0.8,0.7], [0.5,0.3,0.8,0.7], [0.5,0.3,0.8,0.7]]];
I was trying to initialize a three dimensional array in this manner . But here an error is showing unexpected '[' expecting ']'.How to get rid of this error?
int t=4; int b=3; int e=5; range time =1..t; range bus=1..b;
range ev=1..e;
float soci[ev][bus][time]=
[[[0.5,0.3,0.8,0.7], [0.5,0.3,0.8,0.7], [0.5,0.3,0.8,0.7]] ,[[0.5,0.3,0.8,0.7],
[0.5,0.3,0.8,0.7], [0.5,0.3,0.8,0.7]] ,[ [0.5,0.3,0.8,0.7], [0.5,0.3,0.8,0.7],
[0.5,0.3,0.8,0.7]] ,[ [0.5,0.3,0.8,0.7], [0.5,0.3,0.8,0.7], [0.5,0.3,0.8,0.7]] ,
[ [0.5,0.3,0.8,0.7], [0.5,0.3,0.8,0.7], [0.5,0.3,0.8,0.7]]];
execute
{
writeln(soci);
}
works fine. You were missing some commas.