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 reference type and pointers.

Answer Posted / k govind

In addition to the previous answer given in Answer #1,
namely References must point to valid objects at the time
of declaration, references also has the following
limitation.

Once a reference is assigned, there's no way you can modify
the reference. However for a pointer type, variable
assignment is legal.

e.g.,

int i, j;

int *pi, *pj;

pi = &i; // pointer to i
pj = &j; // pointer to j

int &k = i; // reference to i

pi = pj; // pi no longer points to i, instead
// it is now pointing to j
k = j; // The reference k is still with i, it is only
// the value of i that is now modified. i is
// assigned the value of j

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Refer to a name of class or function that is defined within a namespace?

1115


To which numbering system can the binary number 1101100100111100 be easily converted to?

1060


Can we declare a base-class destructor as virtual?

1004


Why is c++ difficult?

1039


write a program that withdrawals,deposits,balance check,shows mini statement. (using functions,pointers and arrays)

2375


Write a function to find the nth item from the end of a linked list in a single pass.

977


How would you call C functions from C++ and vice versa?

1168


What is c++ good for?

1060


Explain the difference between realloc() and free() in c++?

1012


What is a try block?

1070


What is the use of turbo c++?

1048


What is the type of 'this' pointer? When does it get created?

949


How can I improve my c++ skills?

1128


How can you link a c program with a c function?

1070


How can you prevent accessing of the private parts of my class by other programmers (violating encapsulation)?

1078