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
Is it possible to write a c++ template to check for a function's existence?
How can you specify a class in C++?
What is the need of a destructor?
Which bitwise operator is used to check whether a particular bit is on or off?
Difference between pointer to constant vs. Pointer constant
What is a constructor in c++ with example?
Can you pass a vector to a function?
What is the iunknown interface?
Is java made in c++?
What is a container class?
What is the difference between a definition and a declaration?
What is virtual base class uses?
What is using namespace std in cpp?
What do you mean by storage classes?
Do the names of parameters have to agree in the prototype, definition, and call to the function?