References
In the previous chapter, we briefly mentioned references without explaining them in detail. References are object aliases; that is, they refer to objects and as such they must be immediately initialized. They are not objects, so there are no pointers to references or arrays of references.
There are two different types of references in C++: lvalue and rvalue references.
Value categories
C++ expressions have either lvalue or rvalue value categories. There is a more detailed division of value categories, but we will stay with this simple one which has a historical origin.
Lvalues usually appear on the left side of the assignment expression, but this is not always the case. Lvalues have an address that the program can access. Here are some examples of lvalues:
void bar();
int a = 42; // a is lvalue
int b = a; // a can also appear on the right side
int * p = &a; // pointer p is lvalue
void(*bar_ptr)() = bar; // func pointer bar_ptr is lvalue
Rvalues...