A reference must always refer to some object and, therefore, must always be initialized. Pointers do not have such restrictions. A pointer can be reassigned to point to different objects while a reference always refers to an object with which it was initialized.
You can read this post “reference vs pointer“. In which I have explained the difference between pointer and reference with the help of programming examples.
Answer:
A reference must always refer to some object and, therefore, must always be initialized. Pointers do not have such restrictions. A pointer can be reassigned to point to different objects while a reference always refers to an object with which it was initialized.
You can read this post “reference vs pointer“. In which I have explained the difference between pointer and reference with the help of programming examples.
need an explanation for this answer? contact us directly to get an explanation for this answer