The operator *
means follow the arrow.
*P
is the name of the newly allocated memory.
*P = 4.2;
What happens if we do
P = NULL;
?
The dynamically allocated memory is dangling.
*P
was the only name we had for it, and now it has been overwritten.
To return memory from the earlier state:
invoke
free(P)