In a 2 dimensional array, my 0,0 spot keeps changing
I have a 10x10 array, initialized to all zeros.
I create 2 random numbers for the purpose of guessing a position in the array.
However, when I print the array, the 0,0 spot keeps shifting to match the 2nd random number generated.
Is there something strange about the 0,0 spot?
Here is my code:
Code:
seedrnd();
for (x=0;x<2;x++)
{
randArray[x]=rnd(10);
}
for (x=0;x<2;x=x+1)
{
printf("randArray[%i] = %i\n",x,randArray[x]);
}
randRow=randArray[0];
randColumn=randArray[1];
printf("%i Random Row \n",randRow);
printf("%i Random Column \n",randColumn);
printf("[0][0] = %i\n",oppBoard[0][0]);
printf("[0][1] = %i\n",oppBoard[0][1]);
The 2nd to last print statement actually prints randColumn.
The last print statement correctly prints 0.
Any advice?
Thanks...Brownie5