9.3 — Lvalue references – Learn C++

PHOTO EMBED

Wed Mar 16 2022 19:35:13 GMT+0000 (Coordinated Universal Time)

Saved by @pham24n #c++

int main()
{
    int& invalidRef;   // error: references must be initialized

    int x { 5 };
    int& ref { x }; // okay: reference to int is bound to int variable

    return 0;
}
content_copyCOPY

https://www.learncpp.com/cpp-tutorial/lvalue-references/