Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C++ (http://www.go4expert.com/articles/cpp-tutorials/)
-   -   Difference between Pointers and Reference in C++ (http://www.go4expert.com/articles/difference-pointers-reference-cpp-t5492/)

alexsmth114 11Mar2011 10:15

Re: Difference between Pointers and Reference in C++
 
Really nice comparison, useful post, keep them coming!!..

msdnguide 27May2011 20:04

Re: Difference between Pointers and Reference in C++
 
Reference is just an alias. Like a different name to same variable where as Pointer is the actual memory location where the variable is stored

sachin.magdum 29Jan2012 22:50

Re: Difference between Pointers and Reference in C++
 
Little curious about fourth difference. Can we really not create reference to reference?

int obj;
int & ref = obj;
int & ref_2 = ref; // although equivalent to int & ref_2 = obj;
// I agree that we do not have some thing like int & & ref_to_ref = ref;

------------------------------------------------------
1. There exists void pointers, but no void references.
2. Pointer is a variable, that has its own address. References are alias to some other variable, references do not have their own address.

sura 4Feb2012 22:02

Re: Difference between Pointers and Reference in C++
 
nice.


All times are GMT +5.5. The time now is 08:45.