Computer Applications
When an argument is passed by reference,
- a variable is created in the function to hold the argument's value.
- the function cannot access the argument's value.
- a temporary variable is created in the calling program to hold the argument's value.
- the function accesses the argument's original value in the calling program.
User Defined Methods
10 Likes
Answer
the function accesses the argument's original value in the calling program.
Reason — In call by reference, the called method does not create its own copy of original values, rather, it refers to the original values through the references. Thus, the called method works with the original data and any change in the values gets reflected to the data.
Answered By
5 Likes
Related Questions
Given the method below, write a main() method that includes everything necessary to call given method.
int thrice (int x) { return x * 3 ; }What is the principal reason for passing arguments by value ?
What is the principal reason for passing arguments by reference ? In a function call, what all data items can be passed by reference ?
What is the role of a return statement in a method ?