src/main.c
/*
 * Function To Return Game Status
 * 1 for game over with result
 * -1 for game in progress
 * 0 game over with no result
 */
Function To Return Game Status
1 for game over with result
-1 for game in progress
0 game over with no result
Function To Return Game Status 1 for game over with result - 1 for game in progress 0 game over with no result
int checkForWin() {
    int returnValue = 0;
    if(square[1] == square[2] && square[2] == square[3]) {
        returnValue = 1;
    }
    else if(square[4] == square[5] && square[5] == square[6]) {
        returnValue = 1;
    }
    else if(square[7] == square[8] && square[8] == square[9]) {
        returnValue = 1;
    }
    else if(square[1] == square[4] && square[4] == square[7]) {
        returnValue = 1;
    }
    else if(square[2] == square[5] && square[5] == square[8]) {
        returnValue = 1;
    }
    else if(square[3] == square[6] && square[6] == square[9]) {
        returnValue = 1;
    }
    else if(square[1] == square[5] && square[5] == square[9]) {
        returnValue = 1;
    }
    else if(square[3] == square[5] && square[5] == square[7]) {
        returnValue = 1;
    }
    else if(square[1] != '1' && square[2] != '2' && square[3] != '3' && square[4] != '4' && square[5] != '5' && square[6] != '6' && square[7] != '7' && square[8] != '8' && square[9] != '9') {
        returnValue = 0;
    }
    else {
        returnValue = -1;
    }
    return returnValue;
}
int checkForWin ( ) { int returnValue = 0 ; if ( square [ 1 ] == square [ 2 ] && square [ 2 ] == square [ 3 ] ) { returnValue = 1 ; } else if ( square [ 4 ] == square [ 5 ] && square [ 5 ] == square [ 6 ] ) { returnValue = 1 ; } else if ( square [ 7 ] == square [ 8 ] && square [ 8 ] == square [ 9 ] ) { returnValue = 1 ; } else if ( square [ 1 ] == square [ 4 ] && square [ 4 ] == square [ 7 ] ) { returnValue = 1 ; } else if ( square [ 2 ] == square [ 5 ] && square [ 5 ] == square [ 8 ] ) { returnValue = 1 ; } else if ( square [ 3 ] == square [ 6 ] && square [ 6 ] == square [ 9 ] ) { returnValue = 1 ; } else if ( square [ 1 ] == square [ 5 ] && square [ 5 ] == square [ 9 ] ) { returnValue = 1 ; } else if ( square [ 3 ] == square [ 5 ] && square [ 5 ] == square [ 7 ] ) { returnValue = 1 ; } else if ( square [ 1 ] != ' ' && square [ 2 ] != ' ' && square [ 3 ] != ' ' && square [ 4 ] != ' ' && square [ 5 ] != ' ' && square [ 6 ] != ' ' && square [ 7 ] != ' ' && square [ 8 ] != ' ' && square [ 9 ] != ' ' ) { returnValue = 0 ; } else { returnValue = -1 ; } return returnValue ; }
Function To Return Game Status
 1 for game over with result
 -1 for game in progress
 0 game over with no result
Function To Return Game Status 1 for game over with result - 1 for game in progress 0 game over with no result