I am attempting to make a program that allows two player checkers. The teacher said it must use a 2d array but when it runs it says the array is out of bounds.
int[][] pieceStatus[3][7];
it is a four by eight because half of the squares on the chessboard (in this case black) are not used.
int j=0;
for (int i = 0; i<=7; i++)
{
if(i<3)
{
pieceStatus[j][i]=1;
}
if(i>2&&i<5)
{
pieceStatus[j][i]=0;
}
if(i>4)
{
pieceStatus[j][i]=2;
}
if(i==7&&j<=3)
{
i=0;
j++;
}
}
Zero means that there is no piece there.