Write difference between Reference and Pointer.
Answers
Answered by
0
Pointers can point nowhere ( NULL ), whereas a reference always refers to an object. You can't take the addressof a reference like you can withpointers. There's no "referencearithmetic" (but you can take the address of an object pointed by areference and do pointer arithmetic on it as in &obj + 5 ).
shreya3333:
yes , right
Answered by
0
Difference between Reference and Pointer:
Pointer:
- The pointer variable returns the value of the variable
- A pointer can be NULL i.e empty.
- We can create a pointer without initializing it.
- We can initialize the pointer at any point in time in our code.
Reference:
- The reference variable returns the address of the variable.
- The reference variable cannot be NULL.
- We can’t create a reference variable without initialization.
- We have to initialize the reference variable when we are creating it otherwise it will throw an error.
Similar questions
English,
7 months ago
English,
7 months ago
Computer Science,
7 months ago
Computer Science,
1 year ago