In C ++, the ampersand ( &) character can be used to get the lvalue address, function pointer, or qualified name ..
int y;
int* p_to_y = &y;
A symbol is shared in C ++ as a reference declarator.,
int y;
int& y_alias = y;
When learning C ++ after a superficial knowledge of C, this double use caused me a lot of confusion! I understand that the context in which the symbol is used matters, but given that references and pointers are important concepts that should not be confused, can anyone suggest why it &was redesigned rather than using a new alternative symbol?
source
share