InterviewSolution
| 1. |
What Is Meant By Reference Variable In C++? |
|
Answer» In C++, reference variable allows you create an alias (SECOND name) for an already existing variable. A reference variable can be used to access (read/write) the original data. That MEANS, both the variable and reference variable are attached to same memory location. In effect, if you CHANGE the value of a variable USING reference variable, both will get changed (because both are attached to same memory location). In C++, reference variable allows you create an alias (second name) for an already existing variable. A reference variable can be used to access (read/write) the original data. That means, both the variable and reference variable are attached to same memory location. In effect, if you change the value of a variable using reference variable, both will get changed (because both are attached to same memory location). |
|