im writing a function that will calculate the length of a players first and last name then swapping them if the length of player1 is greater than player2, but when I try compiling the code I get the error
"no match for 'operator[]' in 'player[playerNumber]'
1 2 3 4 5 6 7 8 9
void playOrder(Players& player){
int player1length=player[0].firstName.length()+player[0].lastName.length();
int player2length=player[1].firstName.length()+player[1].lastName.length();
if(player1length>player2length){}
swap(player[0].firstName,&player[1].firstName);
swap(player[0].lastName,&player[1].lastName);
}