So I made a checking function named check();
And well, the "test diagonals" is working but the "test rows" isnt working.
And when I exchange their positions, "test rows" will be the one working while "test diagonals isn't working.
Whats the problem with this?
Code:/* See if there is a winner. */ char check() { int i; /* test diagonals */ if(board[0][0]==board[1][1] && board[1][1]==board[2][2]) return board[0][0]; if(board[0][2]==board[1][1] && board[1][1]==board[2][0]) return board[0][2]; if(board[0][6]==board[1][7] && board[1][7]==board[2][8]) return board[0][6]; if(board[0][8]==board[1][7] && board[1][7]==board[2][6]) return board[0][8]; /* test row*/ for(i=0; i<3; i++) { if(board[i][0]==board[i][1] && board[i][0]==board[i][2]) return board[i][0]; if(board[i][3]==board[i][4] && board[i][3]==board[i][5]) return board[i][3]; if(board[i][6]==board[i][7] && board[i][6]==board[i][8]) return board[i][6]; } }