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 ios :: in in c++?
What is the c++ code?
What does the linker do?
Can I make ios apps with c++?
What is endl?
What is the need of a destructor?
In what situations do you have to use initialization list rather than assignment in constructors?
Is it possible to provide default values while overloading a binary operator?
What is exception handling? Does c++ support exception handling?
Explain the pure virtual functions?
Explain function overloading and operator overloading.
What is a float in c++?
What are friend classes?
what is data encapsulation in C++?
What relational operators if statements in c++?