Question about reference

this is my code int a=1; int& p=a; in this situation that use only 1 memory space , but it have two variable name(a & p) is it right? sorry my poor english

8th Aug 2016, 5:17 AM
ChoiJangdo - avatar
3 Answers
+ 1
your statement technically isn't right, but I see why you think that. it is true that is you call the memory location or p (&p) and memory location of a (&a) it should both say something like 0x0f08a72. however when we access RAM we're not accessing the physical location of our variables but the virtually allocated location. So the physical location of p and a might be on completely separate sticks but virtually they're the same.
8th Aug 2016, 8:17 PM
- 1
中国人吗?汉语说一下你的问题,,也许我能解答,,,my english is poor too,
8th Aug 2016, 10:14 AM
song bohan
song bohan - avatar
- 1
thts chinese and not english r u being sarcastic or what?
8th Aug 2016, 10:17 AM
Suhail Pappu
Suhail Pappu - avatar