Problem with 8x8 Matrix Board

Hello everyone,
I am having trouble with my 8x8 matrix board. I am using this code:

byte c7 = 25; // LD788BX-SS22 pin 13 - left hand column
byte c6 = 43; // pin 3
byte c5 = 45; // pin 4
byte c4 = 28; // pin 10
byte c3 = 49; // pin 6
byte c2 = 27; // pin 11
byte c1 = 23; // pin 15
byte c0 = 22; // pin 16 - right hand column
byte r7 = 29; // pin 9 - top row
byte r6 = 24; // pin 14
byte r5 = 53; // pin 8
byte r4 = 26; // pin 12
byte r3 = 39; // pin 1
byte r2 = 51; // pin 7
byte r1 = 41; // pin 2
byte r0 = 47; // pin 5 - bottom row

// put all pins in an array
byte columnArray[] = {c7,c6, c5,c4,c3,c2,c1,c0};
byte rowArray[] = {r7,r6,r5,r4,r3,r2,r1,r0};


// pins r7 - r0 will have current limit resistor between arduino and matrix pin

byte x; // used for counter
byte y; // used for counter

void setup(){
// set up the cathode outputs - HIGH = off
for (x=0; x<8; x=x+1){
pinMode(columnArray[x], OUTPUT);
digitalWrite(x, HIGH);
}
// set up the anode outputs - LOW = off
for (x=0; x<8; x=x+1){
pinMode(rowArray[x], OUTPUT);
digitalWrite(x, LOW);
}
}

void loop(){
// do  a loop within a loop to cycle thru all LEDs 1 at a time
// should LEDs blink on/off across the matrix, from left to right, then top to bottom
// turn on a row
x=0;
while (x<8){ // row selection
digitalWrite (rowArray[x], HIGH); // turn on cathode
  // then turn on 1 column
  for (y = 7; y>=0; y=y-1){
    digitalWrite (columnArray[y], LOW);
    // hold for 1/4 second
    delay(550);
    // turn it off
    digitalWrite (columnArray[y], HIGH);
   } // go to next column
//turn off row
digitalWrite (rowArray[x], LOW); // turn off cathode
x++;
} // go to next row

} // end loop

The program is supposed to turn on every col on by one and close one by one the lights of each row. Well when it starts it does the job for the first col. the others never light on. After a while, eatch row lighting up. But i never wrote a code to do so. Can any one help me with that?

i am using arduino mega and my wiring are just as mentioned in the code’s comments. Thanks in advance.

Actually i got it working… I just changed the second for (the one with y counting) and i added one if so when i light up the first col , only the first light come up and not all together. Sorry for my bad english here is the code:

byte c7 = 25; // LD788BX-SS22 pin 13 - left hand column
byte c6 = 43; // pin 3
byte c5 = 45; // pin 4
byte c4 = 28; // pin 10
byte c3 = 49; // pin 6
byte c2 = 27; // pin 11
byte c1 = 23; // pin 15
byte c0 = 22; // pin 16 - right hand column
byte r7 = 29; // pin 9 - top row
byte r6 = 24; // pin 14
byte r5 = 53; // pin 8
byte r4 = 26; // pin 12
byte r3 = 39; // pin 1
byte r2 = 51; // pin 7
byte r1 = 41; // pin 2
byte r0 = 47; // pin 5 - bottom row

// put all pins in an array
byte columnArray[] = {c7,c6, c5,c4,c3,c2,c1,c0};
byte rowArray[] = {r7,r6,r5,r4,r3,r2,r1,r0};


// pins r7 - r0 will have current limit resistor between arduino and matrix pin

byte x; // used for counter
byte y; // used for counter

void setup(){
// set up the cathode outputs - HIGH = off
for (x=0; x<8; x=x+1){
pinMode(columnArray[x], OUTPUT);
digitalWrite(x, LOW);
}
// set up the anode outputs - LOW = off
for (x=0; x<8; x=x+1){
pinMode(rowArray[x], OUTPUT);
digitalWrite(x, LOW);
}
}

void loop(){
// do  a loop within a loop to cycle thru all LEDs 1 at a time
// should LEDs blink on/off across the matrix, from left to right, then top to bottom
// turn on a row
x=0;
while (x<8){ // row selection
if (x==0){
  for(y=0;y<8;y++){
    digitalWrite (columnArray[y],HIGH);
  }
}
digitalWrite (rowArray[x], HIGH); // turn on cathode
  // then turn on 1 column
  for (y = 0; y<8; y++){
    digitalWrite (columnArray[y], LOW);
    // hold for 1/4 second
    delay(150);
    // turn it off
    digitalWrite (columnArray[y], HIGH);
   } // go to next column
//turn off row
digitalWrite (rowArray[x], LOW); // turn off cathode
x++;
} // go to next row

} // end loop