Arduino raise the error "variable-sized object 'my2dArray' may not be initialized" while trying to change the elements of 2d array I' m trying to change 1 to 0 in two-dimensional (5x5 matrix) for specific servo positions.First, i tried to program forward movement of my robot.  My code is like this:

#include &lt;Servo.h&gt;
#define x 5
#define y 5

Servo myServo;
Servo myServo2;

int pos = 0;

int counter1;
int counter2;
int integer;

void setup() {
  Serial.begin(9600);
  myServo.attach(9);
  myServo2.attach(10);
}

void loop() {

  int my2dArray[x][y]= {
  {1,1,1,1,1},
  {1,1,1,1,1},
  {1,1,0,1,1},
  {1,1,1,1,1},
  {1,1,1,1,1},
  };

  int robot = my2dArray[2][2];

   if (counter1 &gt; 0){
     for (integer = 0;  integer &lt;2; integer +=1){
      int my2dArray[2 + integer][2] = robot * my2dArray[2 + integer][2];

     }
 }
}


  int moveForward(){
  for (pos = 0; pos &lt;= 360; pos += 1) {
    myServo.write(pos);
    myServo2.write(pos);   
    delay(15);
    if (pos == 360){
    counter1 += 1;
    }
    return counter1; 
}
}

int moveBackward(){
  for (pos = 360; pos &lt;=0; pos -= 1) {
    myServo.write(pos);
    myServo2.write(pos);   
    delay(15);
    if (pos == 360){
    counter2 += 1;
    }
    return counter2; 
}
}


But i can' t change the [3][2] and [4][2] elements from 1 to 0. I get an error:

 error: variable-sized object 'my2dArray' may not be initialized


Can you help me?
Thanks.
The error is in this line:

  int my2dArray[2 + integer][2] = robot * my2dArray[2 + integer][2];


The presence of the word int there tells it to try and make a new variable. You don't want to do that, since it's an error.  Lose the int and it might work.