How References Work?
A reference works as a pointer. A reference is declared as an alias of a variable. It stores the address of the variable, as illustrated:

and so a reference variable will has memory, just like pointer and maybe it is a const pointer, the value of the pointer varialbe can not be modified.
more detail, refer https://www3.ntu.edu.sg/home/ehchua/programming/cpp/cp4_PointerReference.html
本文详细解释了在编程中引用和指针的工作原理及其区别。引用作为变量的别名存储变量地址,类似于常量指针,不能修改指向的地址。
950

被折叠的 条评论
为什么被折叠?



