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
Discussion on error handling of C++ .
Does a derived class inherit or doesn't inherit?
Is linux written in c or c++?
What does n mean in c++?
Explain register storage specifier.
Difference between delete and free.
an operation between an integer and real always yeilds a) integer result b) real result c) float result
Explain the differences between private, public and protected and give examples.
What is the difference between a declaration and a definition?
Explain 'this' pointer and what would happen if a pointer is deleted twice?
How long does it take to get good at leetcode?
what are function pointers?
How does class accomplish data hiding in c++?
What are the advantages of using a pointer?
Can we distribute function templates and class templates in object libraries?