Passbyreference
Pass-by-reference is a parameter passing mechanism in which a function receives a reference to the actual data supplied by the caller, rather than a separate copy of that data. Because the parameter names refer to the same memory as the arguments, the function can modify the caller's variables. This is distinct from pass-by-value, where the function works on a copy and changes do not affect the caller.
Implementation varies by language. In C, functions receive values; to allow modification you pass pointers and
Advantages include avoiding copying large objects and enabling functions to modify inputs or to return multiple
Common guidance is to use pass-by-reference when large data structures must be mutated, or when a function