I am trying to define a 2D array in Processing but I don’t seem to be able to get the syntax right.
I have defined the global variable
byte[][] chordBank2;
And in the setup function I have put
chordBank2 = new byte[5][7];
Then I want to put a function in to define my array
This is what I put
void defBank(){ // define array
chordBank2[5][7] = {
{40, 45, 50, 55, 59, 64}; // open strings 0
{40, 47, 52, 56, 59, 64}; // E major 1
{ 41 ,48 , 53, 57, 60, 65}; // F major 2
{ 43, 47, 50, 55, 59, 67}; // G major 3
{ 33 , 45, 52, 57, 61, 64}; // A major 4
{35 , 47, 54, 59, 63, 66}; // B major 5
{ 36 , 48, 52, 55, 60, 64}; // C major 6
{ 38 ,38 , 50, 57, 62, 66}; // D major 7
}
}
But I keep getting
Syntax Error - Missing operator, semicolon, or ‘}’ near ‘{’?
I am unsure of which way round columns and rows go so I have swapped the 5 an 7 over but still no joy.
Can any one point me in the right direction to solving this.
Thanks for reading.