Copy Type and Moved Type
This lesson discusses what happens in tems of memory when variables are assigned to another variable.
We'll cover the following
Copy Type
The ownership state of the original variable (whose value is assigned to another variable) is set to copied state. This means that the value of the assignee variable is copied to the assigned variable. A copy of the value is created so that the assignee variable gets the ownership of the value but both the variables have their own copies.
-
Variable assignment in case of primitive data type is a copy type.
-
pass by value in a function call is an example of copy type
Create a free account to access the full course.
By signing up, you agree to Educative's Terms of Service and Privacy Policy