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 is the rule of three?
What is a tree in c++?
In what situations do you have to use initialization list rather than assignment in constructors?
What is buffering in c++?
What is virtual destructor ans explain its use?
What are the advantages of pointers?
How is modularity introduced in C++?
What is the use of namespace std in C++?
How new/delete differs from malloc()/free?
Can a constructor be private?
What is an undefined behavior and sequence points
Declare a class vehicle and make it an abstract data type.
what is C++ exceptional handling?
To which numbering system can the binary number 1101100100111100 be easily converted to?
What is constructor in C++?