Which is the correct way to specify a reference. I know both works with the compiler, but wanted to know the correct way since I have seen both in code bases.
void Subroutine(int &Parameter)
{
Parameter=100;
}
OR
void Subroutine(int& Parameter)
{
Parameter=100;
}
There is no ‘correct’ way, in the same way like there is no ‘correct’ way to place your parentheses and brackets. It’s a matter of style and preference.
It’s more important to be consistent.