EDIT: Since there is no difference between int * x
, int* x
, and int *x
, I removed that section to better clarify what I'm confused about.
The question:
The differences between "pointers" and "references" are explained in the answer to What are the differences between a pointer variable and a reference variable in C++?, but the syntax itself seems to have different meanings depending on the context.
When a pointer or reference is declared, what do the *
and &
modifiers make those variables mean later? Are they the pointer, the raw value, the object reference, etc.
For example, since words seem to be failing me here:
void foo(int* x, int& y) {
assert(*x == ??);
assert(&x == ??);
assert(*y == ??);
assert(&y == ??);
}