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
What are disadvantages of pointers?
What is the difference between public and private data members?
What does std :: flush do?
What do you mean by const correctness?
How important is c++?
What are the extraction and insertion operators in c++?
What is purpose of abstract class?
Can we specify variable field width in a scanf() format string? If possible how?
What is the type of this pointer in c++?
what is multi-threading in C++?
Is java the same as c++?
Can comments be nested?
Explain the differences between private, public and protected and give examples.
What is the rule of three?
What is the benefit of learning c++?