How can I use a condition result to tell the program which 2D array to address to?
<p>excuse my english</p>

<p>How can I use a condition result to tell the program which array to refer to within a function ?</p>

<p>I would like to take just one certain array at a time, to match its values with a main array, and so far I cannot manage to come up with an idea on how to do such stuff.</p>

<p><strong>example:</strong>
if condition result came up "0", refer to the first array (playerA), if it came up "1" refer the other one (playerB), and so on.
the program will match the CORRECT array values of the corresponding player with the array of "data" which is the main one.</p>

<p>I would have just used switch and let it go, but I try to avoid it as I will have alot of code to duplicate in each case, and alot of cases, so this is silly.</p>

<p>For all it matters, "players" arrays are all 2x2, and will be matched against 2x2 of data array (it's actually has more rows, but i choose specific 2x2 in it to match).
and i need all 4 values in the 2x2 to be matched against the 4 corresponding values of given data-array 2x2</p>

<p>How do i do something like this without a switch or a temporary array inside the funcion ?
A buddy of mine told me I should use a pointer but couldn't show me an example, so I looked it up here and I just don't get it.</p>

<p>I'm a beginner at this as you might have guessed. keep this in mind please.</p>

<p>and thnx in advance</p>

<p>.</p>

<pre><code>int data[2][2] = {{5,5},{5,5}} ;

int playerA[2][2] = {{5,6},{7,8}} ;
int playerB[2][2] = {{1,2},{3,4}} ;

main () {

function(player) ;

}

void function (int activePlayer) {

   // this condition is just so you'd understand what i want
   // because i dont know how to code this part  
    if (activePlayer == 0)
       { pickTheRightArray = playerA } ;
    else if (activePlayer == 1)
       { pickTheRightArray = playerB } ;

    bigger = 0;
    for (x=0 ; x&lt;number ; x++)  {
        if ( pickTheRightArray[x][0] &gt; data [x][0] )
            bigger++;
    };
//etc..etc..etc... do some stuff with this info
</code></pre>