Computer Science, asked by vedprakash1687, 1 year ago

Write difference between Reference and Pointer.

Answers

Answered by megha1738
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
mendoza71: Correct
megha1738: mark me as brainliest
Answered by gratefuljarette
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