Here is my problematic coding: I have to take in 2 player's name. Then when for the next part when the player marker changes the name stored in "currentPlayer" should change too the name stored in either playerOne or playerTwo. It doesn't so how do I fix that? Please solve, I tried to make it a reference variable with the & symbol but I get an error saying array of reference is not allowed.
void boardMarker(int &, char playerOne[], char playerTwo[], char &playerMarker, char currentPlayer[]);
int main()
{
char playerOne[100];
char playerTwo[100];
char currentPlayer[100] = "playername";
boardMarker(playerTurn, playerOne, playerTwo, playerMarker, currentPlayer);
}
void boardMarker(int &playerTurn, char playerOne[100], char playerTwo[100], char &playerMarker, char currentPlayer[100])
{
// Set player markers
//Player 1 uses X and Player 2 uses O
if ( playerTurn == 1 )
{
playerMarker = 'X';
currentPlayer = playerOne;
}
else
{
playerMarker = 'O';
currentPlayer = playerTwo;
}
}