Ask Your Question

Revision history [back]

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.