iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
Call by value means a function receives the evaluated value of an argument in a local parameter. Reassigning that parameter does not, by itself, change the caller’s variable. If the value is a reference to an object, however, caller and function can both reach that same object, so a mutation may be visible to the caller.
What call by value means
When a function call is evaluated, the argument’s value is made available to the function through its parameter. The parameter is a local name in the function. The GNU C Language Manual describes C calls as evaluating argument expressions, converting values as required by the function declaration, and running the function with copies of those converted values. It calls this method “call-by-value.” GNU C Language Manual: Function Call Semantics
For example, if a caller’s variable contains 20 and a function sets its parameter to 5, the parameter becomes 5; the caller’s variable remains 20. The function changed its local parameter, not the caller’s binding.
Free tools Windows power users keep installed
One-click scans. No signup required.
How call by value differs from call by reference
With call by value, assigning a different value to a parameter does not directly replace the caller’s variable. In a true pass-by-reference model, a parameter can act as an alias for the caller’s variable, so assigning through the parameter can change that variable. The key question is whether the function received a separate value or access to the caller’s variable itself.
#1 Best Overall
- Parameter rebinding: Assigning a new value or reference to a local parameter does not change the caller’s variable in the C and Java examples covered here.
- Mutation through a shared reference: If the copied value refers to an object that both caller and function can access, the function may change that object’s state.
Those two operations can look similar in a short example, but they have different effects. Changing an object is not the same as changing the caller’s variable so that it refers to a different object.
Why a function can change an object but not the variable passed to it
A reference to an object is itself a value. When that reference value is copied into a parameter, the caller’s variable and the parameter can initially refer to the same object. The function can use its copy to reach and mutate the object. But if the function reassigns its parameter to refer to another object, only the local parameter is rebound; the caller’s variable still refers to its original object.
Rank #2
In short, the function can share access to an object without sharing the caller’s variable. This distinction is central to understanding Java object arguments and Python mutable objects.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Repair Windows errors before they cause bigger problems3Scan for outdated or missing drivers - takes under a minuteWhat call by value looks like in different languages
C: the parameter gets a copy
The GNU C Language Manual’s example has the caller initialize y to 20, then a function set its local parameter x to 5. After the call, y remains 20. The manual describes arguments as evaluated, converted according to the function declaration, and copied into the function call. Read the GNU C Language Manual’s function-call explanation.
Passing a pointer does not change C’s call-by-value rule. The pointer value is copied into the parameter. The function can use that copied pointer to access the pointed-to storage, so modifying the pointed-to object may be visible to the caller. Reassigning the local pointer parameter, by contrast, does not change the caller’s pointer variable.
Python: an evaluated argument value is assigned to a local name
The Python 3.14.8 glossary defines an argument as a value passed to a function or method and says the evaluated value is assigned to the named local variable. It also distinguishes positional and keyword arguments. Python 3.14.8 glossary
Rank #4
Consider a function parameter named items that receives a list. If the function executes items = [], it rebinds the local name to a new list; the caller’s variable still refers to the original list. If instead it executes items.append("x"), it mutates the list object. The caller may see that change because its variable can refer to the same object. Describing this as “passing the list variable by reference” confuses a local name with the object it refers to.
Recommended Free Tools
Java: object references are passed by value
Java passes reference-type parameters by value too. Oracle’s Java tutorial, written for JDK 8, says: “Reference data type parameters, such as objects, are also passed into methods by value.” A method can use the copied reference to modify an accessible field or call a method that mutates the shared object. Reassigning the method parameter to a new object does not change which object the caller’s variable references. Oracle Java tutorial: Passing Information to a Method or a Constructor
Best Value
A quick way to analyze an argument example
- Identify the parameter’s value. Is it a scalar value, such as an integer, or a reference to an object?
- Look at the operation inside the function. Does it assign a new value or reference to the parameter, or mutate an object reached through that parameter?
- Check what the caller can observe. Rebinding a local parameter leaves the caller’s variable unchanged. Mutating a shared object can change the state the caller observes.
This method separates parameter passing from object mutation, which is the source of many apparent contradictions.
Does call by value mean the function cannot affect the caller?
No. It means that assigning to the parameter does not directly assign to the caller’s variable. If the parameter contains a copied reference to shared, mutable storage, the function may change that storage and the caller may observe the result. The caller’s variable still has its original binding unless the language or program uses another mechanism to change it.
Quick Recap
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.

