Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Call by value means a function receives an argument’s evaluated value in a local parameter. Assigning a different value to that parameter does not, by itself, replace the caller’s variable. If the copied value refers to a mutable object, however, both caller and function may reach that same object, so a mutation can be visible to the caller.
How call by value works
A function call evaluates its argument expression and supplies the resulting value to a parameter. The parameter is a local name in the function. The caller’s variable and the parameter are distinct: assigning a new value to the parameter changes the local parameter, not the caller’s variable.
As an Amazon Associate I earn from qualifying purchases.
For example, if a caller passes the value 20 to a parameter named x, then the function sets x = 5, the caller’s variable remains unchanged. The GNU C Language Manual describes this as call by value: Function Call Semantics.
Why an object can change even when the parameter is passed by value
The value passed to a function may itself be a reference to an object. The function receives a copy of that reference, and the caller’s variable and the local parameter can both refer to the same object. The function can mutate the shared object through its reference; the caller can then observe the changed state. But if the function assigns a different reference to its local parameter, that does not change the caller’s variable.
#1 Best Overall
- Rebinding: Assigning another value or reference to the parameter changes the local parameter only.
- Mutation: Changing the state of an object reached through a shared reference can be visible to the caller.
These are different operations. Being able to mutate an object does not mean the function received the caller’s variable itself.
How the idea appears in common languages
C
The GNU C Language Manual explains that a function call evaluates argument expressions, converts the resulting values as required by the function declaration, and runs the function with copies of those converted values. Its example changes a local parameter initialized from the caller’s value; the caller’s variable remains unchanged. Passing a pointer does not change C’s call-by-value rule: the pointer value is copied, and the function can use that copy to access the pointed-to storage.
Python
The Python 3.14.8 glossary defines an argument as a value passed to a function or method and explains that the evaluated value is assigned to the named local variable. See the official Python glossary.
Recommended Free Tools
If a function receives a list as items, then items = [] rebinds the local name; it does not replace the caller’s variable. By contrast, items.append("x") mutates the list object. If the caller also refers to that object, it can see the appended item.
Java
Java passes reference-type parameters, including objects, by value: the method receives a copy of the reference. The copied reference initially identifies the same object, so changing an accessible field or calling a mutating method can affect that object. Reassigning the method parameter to a new object does not change which object the caller’s variable refers to. Oracle’s tutorial, written for JDK 8, explains this in Passing Information to a Method or a Constructor.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Call by value versus call by reference
In call by value, a parameter receives the argument’s value. Reassigning the parameter does not directly replace the caller’s variable. With call-by-reference semantics, a function can operate on the caller’s variable itself, so assigning through the parameter can change that variable. These terms describe how parameters relate to caller variables—not simply whether a function can affect data the caller can see.
A shared object can make call-by-value code appear to behave like call by reference: the function mutates the object, and the caller sees the mutation. To tell what happened, ask whether the function changed the shared object or rebound its local parameter.
Free tools Windows power users keep installed
One-click scans. No signup required.
Quick Recap
Best Value
A quick way to analyze a function call
- Identify the value produced by the argument expression.
- Ask whether that value is a simple value or a reference to an object.
- Check whether the function reassigns its parameter or mutates an object reached through it.
- Determine what the caller can observe: parameter reassignment alone does not replace the caller’s variable, while mutation of a shared object may be visible.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




