byvalue
By value is a parameter passing convention in programming languages in which a function receives a copy of the actual argument's value. The callee operates on that copy, and changes to the parameter do not affect the original variable in the caller.
How it behaves depends on the language and the type being passed. For primitive or value types,
Because by-value copies create a distinct copy, the callee has its own storage and cannot alter the
Trade-offs include performance costs for large data structures due to copying, and the potential loss of in-place
- In C-like pseudocode, void f(int x) { x = x + 1; } int a = 5; f(a); // a remains 5
- In languages where objects are passed by value of the reference, such as some interpretations of
See also: pass by reference, copy semantics, shallow copy, deep copy, value type, reference type.