Multidimensional Arrays
Hi
What exactly is the write way to do this?:
What exactly is the write way to do this?:
int Weights[4][4] = {{1, 1, 1, 1}, {2, 2, 2, 2}, {3, 3, 3, 3}, {4, 4, 4, 4}};
//Try this;
//First define array as local or global in or out of the subroutine respectively;
int Weights[4][4];
//Than write data if you must but you do not need to;
//The error is usually result of your attempt to write data to array before it was defined;
Weights[0][0]=data0;
Weights[0][1]=data1;
Weights[0][2]=data2;
Weights[0][3]=data3;
................
................
................
Weights[3][0]=data12;
Weights[3][1]=data13;
Weights[3][2]=data14;
Weights[3][3]=data15;
// Use a loop;
//To initialise all array elements to "2" you may use
ArrayInitialize(Weights, 2);
MetaEditor compains saying "initialization expected", when thats what I gave it :(
That should work;
int Weights[4][4] = { 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4};
What exactly is the write way to do this?:
int Weights[4][4] = {{1, 1, 1, 1}, {2, 2, 2, 2}, {3, 3, 3, 3}, {4, 4, 4, 4}};MetaEditor compains saying "initialization expected", when thats what I gave it :(