I have studied Java and Go so far. Passing by value / passing by reference in these two languages is organized here.
Pass by value
(call by value): A method of making a new copy of the value and passing it to the argument of the method.Pass by reference
(call by reference): A method of passing a reference to the variable itself as a method argument.pass by value
.reference value
is passed.pass by reference
by passing a pointer as an argument.value types
. That is, an image that secures a place to store all the fields / elements and stores it in a variable representing a structure.pass by value
a structure, all of its fields will be copied. Even if this is rewritten, the original structure is not rewritten.reference type
(similar to Java objects). That is, what is contained in the variable is a container that contains the pointer of the element, and the image that follows the pointer to access each element (Reference 09/26/19 0000)).passed by value
, the original map / slice will be rewritten. So it usually doesn't make sense to pointer pass
these, and usually doesn't (reference).passed by reference ≒ passed by pointer
, but the details there are detailed in here.value type
/ reference type
may not be accurate, so please take it as an image.