Is the reference variable address and the existing variable address is same or not, In C++. | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 1

Is the reference variable address and the existing variable address is same or not, In C++.

19th Jan 2019, 5:36 AM
Ayush Sahu
Ayush Sahu - avatar
1 Respuesta
+ 4
Reference variables are aliases for an existing variable, i.e. different names for the same variable. Hence, they both refer to the same memory address. You can do a quick check yourself. int a = 39; int& b = a; std::cout << &a << " " << &b;
19th Jan 2019, 5:46 AM
Hatsy Rei
Hatsy Rei - avatar