Pointing to multiple arrays

Hello all,

I have made several arrays. I have a loop running and would like it so that everytime the loop cycles it adds a count to an int. Based on the state of this int it would select a different array. for example.

 int fi[10][6]={{0,0,0,0,0,0},{1023,0,0,600,250,0},{0,0,0,0,0,0}};
int gi[10][6]={{0,0,1023,600,450,450},{1023,0,0,600,250,0},{0,0,1023,600,450,450}};
int hi[10][6]={{1023,550,0,600,450,450},{1023,0,0,600,250,0},{1023,550,0,600,450,450}};

right now I have this going on.

if (int==0){
               ls0 = fi[i][0]; ls1 = fi[i][1]; ls2 = fi[i][2];}

if (int==1){
               ls0 = gi[i][0]; ls1 = gi[i][1]; ls2 = gi[i][2];}

if (int==2){
               ls0 = hi[i][0]; ls1 = hi[i][1]; ls2 = hi[i][2];}

now there is much more code than that, that is a simplified version. But I would like to replace the fi,gi, and hi with an integer such as x for instance so that it would look like this.

if (int==0){x=fi;}
else if (int==1){x=gi;}
else if (int==2){x=hi;}


               ls0 = x[i][0]; ls1 = x[i][1]; ls2 = x[i][2];

I tried this but got a bunch of Array errors about declaration and such. Sorry that i didnt save the errors and have since erased the example code. But i am just wondering why it didnt work, I tried putting the x in brackets such as (x) and that didnt work either.

Is it possible to call arrays like this or do i manually have to write the code over and over for each state of int?

thanks jeremy

one solution is that X be a pointer to an int, but as the arrays are two dimensional this is not trivial as the pointer does not know the #rows of the array.

A better solution is to make one 3 dimensional array as all the three are the same size, something like this

int numbers[3][10][6] =
  {
    {
       {0,0,0,0,0,0},
       {1023,0,0,600,250,0},
       {0,0,0,0,0,0}
    },
    {
       {0,0,1023,600,450,450},
       {1023,0,0,600,250,0},
       {0,0,1023,600,450,450}
    },
    {
       {1023,550,0,600,450,450},
       {1023,0,0,600,250,0},
       {1023,550,0,600,450,450}
    }
  };

ls0 = numbers[x][i][0];
ls1 = numbers[x][i][1];
ls2 = numbers[x][i][2];

Probably you should make - ls - an array too

This doesn't make any sense:

if (int==0){

The word "int" is a data type, not a variable.

Thanks robtillaart,

I hadnt thought of doing a three dimensional array. This should work great.