Pointer vs. reference.
Page 1 of 1
Pointer vs. reference.
When a reference is created, it can’t reference another object. This can be done with pointers. References cannot be null whereas pointers can be. References cannot be uninitialized and it is not possible to refer directly to a reference object after it is defined.
Example:
Syntax of reference:
<Type> & <Name>
int& rA = A; rA is a reference to int.
Similar topics
» What is the type of “this” pointer? When does it get created?
» Explain dangling pointer.
» What is container class? Explain containers of pointer.
» Explain passing objects by reference, passing objects by value and passing objects by pointer.
» Explain dangling pointer.
» What is container class? Explain containers of pointer.
» Explain passing objects by reference, passing objects by value and passing objects by pointer.
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|