I have an arduino project which uses a 2 dimensional array to track row/column info. If I try to assign a row,column pair to a particular element I get an error:
expected primary-expression before '{' token
I can assign individual values without problem but get an error if I try to assign the second array element as an integer pair.
example:
player[0][0] = 1;
player[0][1] = 2; //this works
//but . . .
player[0] = {1,2}; //doesn't work
//here is more specific code from the project
// …. a bunch of code here declaring various global variables
int players[6][2]; //two dimensional array with 6 players each with a 2 value array (column and row)
int score1; //player 1 score
int score2; //player2 score
//code here for setup/loop/etc.. Code calls the setPlayerPositions() function
void setPlayerPositions()
{
players[0] = {2,1}; //set the position of the ball (player[0]) to row 2, column 1
players[1] = {1,4}; //set other player positions . . .
players[2] = {2,4};
players[3] = {3,4};
players[4] = {2,6};
players[5] = {2,9};
}