I had the following code to try and get 2 values for 2 different players, however this code is causing an unwanted third line to appear as shown below.
for(int i = 0; i < 6; i++){
printf("Player %c>", player);
fgets(move, 4, stdin);
y_coord = strtok(move, sp);
x_coord = strtok(NULL, sp);
printf("You entered: %s, %s\n", x_coord, y_coord);
if(player == 'O'){
player = 'X';
}
else{
player = 'O';
}
}
output:
Player O>5 5
You entered: 5, 5
Player X>You entered: (null),
Player O>^C