2
I’ve been studying some codes I found on the Internet, and one of them used a prototype implementation as follows:
void changeMode(Mode &m){
m.loop = true;
m.quit = false;
}
See that function changeMode
receives a type structure as a parameter Mode
. What I didn’t understand was the operator &
. It also passes as argument as follows:
changeMode(player_mode);
I would like to know why the operator was used &
and not the operator *
. What changes from one to the other? So far, I know the &
represents memory address, and *
indicates a pointer. How could a function be receiving an address? Thank you.