Shallow copying copies addresses, not values:
int *ptr = nullptr;
int x = 43;
ptr = &x; Deep copying copies values, not addresses, and is safer:
int *ptr = nullptr;
int x = 43;
*ptr = x; Shallow copying copies addresses, not values:
int *ptr = nullptr;
int x = 43;
ptr = &x; Deep copying copies values, not addresses, and is safer:
int *ptr = nullptr;
int x = 43;
*ptr = x;