Love to do some charity work. Have a passion for writing and do it in my spare time
W. Mocroft, Philanthropist, Master Degree in International Business, Las Vegas
Answered Aug 29, 2019
A pointer and reference may seem to be the same thing, but these two are different from each other. A pointer can be used when you are trying to create some data structure and also other algorithms. You are going to use references when you are trying to develop some types that will allow you to do some self-documentation. For example, you want to make sure that you will remember a specific paragraph on a page.
You can use a pointer for that. The pointer can also be changed up from time to time. The reference will allow you to compare different sentences that may connect. These tools will allow you to get the information that you are looking for.
A pointer is used to store the memory address of variables. It basically holds the memory of another variable. A pointer is to be dereferenced with an operator to aces the memory location of the variable it points to. A reference on the other hand, is also used to store memory address of existing variables.
A reference is alias for an object meaning the second variable shares the same memory address just as the first variable. The second variable can be used to perform task that the first variable can carry out since they have the same memory address.
Pointer and reference are two important variables which can be used by a compiler in knowing the storage of an item. However, there are many differences between pointer and reference. A pointer is used in storing the memory address of another object or variable. The use of pointers to store the memory address of variables will reduce the problems that are usually encountered by programmers in identifying the needed variables, and this will also enhance the manipulation of those variables.
A pointer is used to represent values for easy manipulation. Reference, on the other hand, is used in storing the memory address of an existing variable. The idea behind the use of reference is that, it offers programmers the opportunity to use the second variable which already shares the same memory address as the first variable. All the contents in the first variable will also be found in the second variable, which means the second variable can be used in performing different operations just as the first variable.