In deep copy concept , i have a doubt

in the video ,
the code is
Car(Car &X)
{ …
name = new char[l+1];
strcpy(name,X.name);
}
Doesnt this also create a shallow copy. as first you the pointer name contains the address of a new array , but then we copy the address contained by X.name into name. so the address of the new array gets overwritten

@Anchal
strcpy( ) doesn’t copy the address of the array. It copies the data in that array. So the data of X.name gets copied to name . Both the pointers however still retain their original addresses.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.