What is the difference between reference type and pointers.

Answer Posted / manoj kumar kar

Difference 1>
Reference must point to valid objects at the time of
declaration where pointer need not point to valid objects
at the time of declaration means
int nvalue=5;
int &rnvalue; //This is invalid.
int &rnvalue=nvalue; //This is valid.

But
int *rnvalue; //This is valid.
rnvalue=&nvalue;
Difference 2>
Pointer is a variable which holds the address of another
variable.
But Reference is another name of the same variable.

Is This Answer Correct ?    18 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a corrected statement in c++ so that the statement will work properly. if (4 < x < 11) y=2*x;

1592


What is the difference between reference and pointer?

707


What are the advantage of using register variables?

740


Define pure virtual function?

643


What does it mean to declare a destructor as static?

712






Why is c++ considered difficult?

735


Is empty stack c++?

612


Explain storage qualifiers in c++.

706


Is it possible to have a recursive inline function in c++?

657


What is the difference between map and hashmap in c++?

659


What is the most useful programming language?

691


Why are arrays usually processed with for loop?

862


What do you mean by static variables?

687


What are stacks?

712


How do I exit turbo c++?

670