trouble with void function.

I'm busy with programming my cube. Now I'm pretty much done with my code, however I want to simplify my code. This is where I have some problems:

int Array1[5][6] = {{ , , , , ,}, {, , , , ,}, etc}; // this is an animation for my led cube
int Array2[5][6] = {{ , , , , ,}, {, , , , ,}, etc}; // this is another animation for my led cube
void shift_out(char animation);

void loop(){
shift_out(Array1[a][b]); //'[a][b]' is used in the for loop from shift_out
delay(1000);
shift_out(Array2[a][b]);
}

void shift_out(char animation){
for(int a=0; a<5; a++){
      digitalWrite(latchPin, LOW);
      for(int b=0; b<6; b++){
        shiftOut(dataPin, clockPin, MSBFIRST, animation); // animation need to become Array1[a][b] or Array2[a][b]
      }
      digitalWrite(latchPin, HIGH);
      delay(1);
    }
}

So if I want Array1 to show on my led cube, I need to take Array1[a][b ] to shift_out, when I go to shift_out 'animation' need to be Array1[a][b ]. When I want to show Array2 on my led cube, I need to take Array2[a][b ] to shift_out, when I go to shift_out 'animation' need to be Array2 [a][b ] I know its not working with char( a and b need to be declared aswell), I only wrote char in the piece of code to make it more clear what I want to do.

I can get it working if I give a and b a specific number. Like if I say Array[1][1], Array[1][1] can be written to an integer. Then I have no problems to get it to my shift_out function.

I hope I made it clear enough to understand, its kinda hard to explain :cold_sweat:.

To clarify. You want to pass the name of an array to a function ?
It sounds like passing a pointer would do what you want

In the function 'shift_out' I want 'animation' to be changed in like Array1[a][b ] or Array2[a][b ]. So the code will look something like this:

void shift_out(){
for(int a=0; a<5; a++){
      digitalWrite(latchPin, LOW);
      for(int b=0; b<6; b++){
        shiftOut(dataPin, clockPin, MSBFIRST, Array1[a][b]); <--------------------------- 
      }
      digitalWrite(latchPin, HIGH);
      delay(1);
    }
}

That's what I thought I suggested
Have you had a look at the link I gave ?

Yes yes :D, I'm still trying to figure it out with the link you gave me. I just answered the question to make sure you understand what I'm trying to do :stuck_out_tongue:

Though I still can't get it working... I don't know exactly what i'm doing. Maybe can you give me a push in the right direction and make a start in my code I posted? Right now I'm doing it wrong...

Have a look at this. It may give you a push in the right direction

byte Array1[3][2] = 
{
  {1,2},
  {3,4},
  {5,6}
};

byte Array2[3][2] = 
{
  {11,22},
  {33,44},
  {55,66}
};

void setup() 
{
  Serial.begin(9600);
  showArray(Array1);
  Serial.println();
  showArray(Array2);  
}

void loop() 
{
}

void showArray(byte passedArray[3][2])
{
  for (byte row =0;row < 3;row++)
  {
    for (byte col =0;col < 2;col++)
    {
      Serial.println(passedArray[row][col]);
    }  
  }
}

Thank you very much! Got it working now :). Now I also understand what they are doing in the link you posted! Thanks again!