A reference in C++ is an alias to a data instance. Anything that comes remotely close to a reference is a const pointer. However, there are substantial number of differences between references and pointers that it would be a mistake to think of a reference as merely a const pointer. Nonetheless, as a reference by nature is a const type it must refer to a data instance before it can be used.
These are some reference initialization use cases.
A simple initialization:
int x = 10;
int& refx = x;
A conditional initialization:
int y1 = 10;
int y2 = 11;
int& refy = y1 > y2 ? y1 : y2;
A member reference must be initialized in initializer-list of constructor:
struct A {
A(int& x):membRef(x) { // Initializer-list is must here
}
int& membRef; // it must be initialized in constructor
};
Finally, to understand more about reference initialization tell us which one of followings is a false statement: