Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is the difference between Pointer and a Reference?
When you would use them?

Answer Posted / srihariraju

A reference just renames a memory location for the
reader/programmer. Its more like renaming a constant with
#define. The reference does not really 'contain' the
address, instead the comiler *could* just substitute the
address for the reference at the assembly code level.

A pointer is a variable (it 'must' have a memory location
of its own (barring odd compiler tricks)) that *can* be
used like a reference or it can point to nothing (NULL) (a
reference cannot do that) and a pointer can get new memory
from the os (new command) while a reference must 'point' to
existing memory.

Is This Answer Correct ?    14 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between a definition and a declaration?

1111


What are register variables?

1212


Is empty stack c++?

1054


What is prototype in c++ with example?

1227


What is difference between c++ 11 and c++ 14?

1166


Explain method of creating object in C++ ?

1150


Explain the difference between abstract class and interface in c++?

1033


Are there any special rules about inlining?

1127


What are abstract data types in c++?

1035


What is nested class in c++?

1012


How can you create a virtual copy constructor?

1129


What is stream and its types in c++?

1102


Why c++ is so important?

1137


What are shallow and deep copy?

1171


what are the types of Member Functions?

1175