I spent some time on this but I can't figure out why it's not exiting the for loop.
for (int i = 1; i < rows - 1; i++) {
printf("before copy\n");
copyArray(rows, columns, table, temp);
printf("after copy\n");
for (int j = 0; j < columns; j++) {
printf("inside j\n");
if (table[i][j] == xOrO && table[i + 1][j] == xOrO && table[i - 1][j] == '.') {
temp[i - 1][j] = xOrO;
if (guessTwoMoves(rows, columns, temp, xOrO, playerPiece)) {
copyArray(rows, columns, temp, table);
return ('A' + j);
}
}
}
printf("before break\n");
printf("%i \n", i);
if (i == 4) break;
printf("inside i\n");
}
printf("outside 3rd");
This is what I get: The i = 4
but it doesn't exit the loop for some reason Check the image to see the output. I am still not used debugging in the terminal so I used print statements. Please check the picture below