|
ILLUSTRATION-III
*y=x; // gives an ERROR as data types don’t match. x is not an int but pointer to int
x=*y; // gives ERROR again as *y is not Int* but int. In other words *y is not a pointer but a Int value while x is int* i.e. pointer to int.
*y=i; // both the data types are same INT and hence value of i is assigned to pointee of y.
i=7; // value of i is changed i.e. pointee of x is changed.
Memory map at this moment showing result of above 2 statements is as:

x=y; // both x& y are int* i.e. pointers. Now both pointers point to same place and previous pointee of x retains the value.
Memory map at this moment is as:
|