I've been studying some of the 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 the changeMode
function is given a structure of type Mode
. What I did not understand was the &
operator. It also passes as argument as follows:
changeMode(player_mode);
I'd like to know why the &
operator was used instead of the *
operator. What changes from one to the other? So far, I know that &
represents memory address, and *
indicates a pointer. How could a function be receiving an address? Thank you.