When a variable is defined as type "&var = *ptr", it means that the variable is a reference to the address of the memory location pointed to by the pointer. Any changes made to the value of the variable will also affect the value of the data stored in that memory location.
On the other hand, when a variable is defined as type "var = *ptr", it means that the variable is simply assigned the value of the data stored in the memory location pointed to by the pointer. Any changes made to the value of the variable will not affect the value of the data stored in that memory location.
In summary, defining a variable as type "&var = *ptr" creates a reference to the data, while defining it as type "var = *ptr" creates a copy of the data.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2023-05-24 05:09:24 +0000
Seen: 9 times
Last updated: May 24 '23