Where ampersand “&” can be put when passing argument by reference?

Both are exactly the same. No difference at all.

All that matters is that & should be between the type and the variable name. Spaces don’t matter.

So

void AddOne(int&  y);
void AddOne(int  &y);
void AddOne(int & y)
void AddOne(int   &     y);
void AddOne(int&y);

are same!

Leave a Comment