The & should follow type or in front of the parameter when using reference as function parameter?

from what I know, if we use pointer or reference as a function parameter, it could written like this: for reference:

void myfunction(int& x);

for pointer:

void myfunction(int *x);

but I recently see people written like this:

void myfunction(int &x);

I think it is still a reference, but if in general &x means getting the address of x, right? So, I am confused. Please help.

Read more here:

Content Attribution

This content was originally published by DannnnT at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: