Question

# bool update(char userInput){ int i = board_height - 1; int j = userInput - 'A'; while(i>=0){...

bool update(char userInput){

int i = board_height - 1;

int j = userInput - 'A';

while(i>=0){ if(board[i][j] == ' '){

board[i][j] = next;

if(checkRow(i,j,next) || checkColumn(i,j,next) || checkLeftDiagonal(i,j,next) || checkRightDiagonal(i,j,next)){

global_state = next - '0';

} if(next == '1'){

next = '2';

}else{

next = '1';

} break;

} i--;

} if(i == -1){

return false; }

return true;

}

How can this be turned into int update instead of bool update

// chaged return type to int
int update(char userInput){

int i = board_height - 1;

int j = userInput - 'A';

while(i>=0){ if(board[i][j] == ' '){

board[i][j] = next;

if(checkRow(i,j,next) || checkColumn(i,j,next) || checkLeftDiagonal(i,j,next) || checkRightDiagonal(i,j,next)){

global_state = next - '0';

} if(next == '1'){

next = '2';

}else{

next = '1';

} break;

} i--;

} if(i == -1){
// here false means 0 so we can return 0
return 0; }
// here true means 1 so we can return 1
return 1;

}

NOTE : PLEASE COMMENT BELOW IF YOU HAVE CONCERNS.

Please Like and Support me as it helps me a lot

#### Earn Coins

Coins can be redeemed for fabulous gifts.