Difference Between Call By Value and Call By Reference?
Answers were Sorted based on User's Feedback
Answer / kruthicse
Call By Value:
Creates a new memory loaction for use within the
subroutine.The memory is freed once it leaves the
subroutine.Changes made to the variable are not affected
outside the subroutine.
Call By Reference:
Passes a pointer to the memory location.Changes made to the
variable within the subroutine affects the variable outside
the subroutine.
Is This Answer Correct ? | 580 Yes | 131 No |
IN CALL BY VALUE, BOTH THE ACTUAL AND FORMAL PARAMETERS
WILL BE CREATED IN DIFFERENT MEMORY LOCATIONS WHEREAS IF
THEY ARE CALLED BY REFERENCE BOTH WILL BE CREATED AT THE
SAME LOCATION.
Is This Answer Correct ? | 369 Yes | 123 No |
Answer / ashish awasthi
in call by value method,a compiler get a copy of the
variable and thus changes made in the value in function
will not reflected back to the called function.but in call
by reference method,the compiler didn't get any copy ,but
actually it works on the original copy and thus changes
will be reflected back
Is This Answer Correct ? | 261 Yes | 59 No |
Answer / shrikant patil
Call by value method:
passing the value of variable to the function.
void main()
{
int x=10,y=20;
printf("%d%d',x,y);
swap(x,y);
}
void swap(int a,int b)
{
int c;
c=a;//changes here do not affect in values
a=b;//of x and y in main function..
b=c;
}
call by reference method:
passing the address of variable to the function.
swap(&a,&b)
&c=&a;
&a=&b;
&b=&c;
changes made in subfunction causes changes in address of
variables n thus in main () also..
Is This Answer Correct ? | 155 Yes | 33 No |
Answer / vinay kumar gupta
call by value :
call by value means programmer send some value coping from
one function to another.At the time of function calling a
programmer can send a copy of variable of value.
call by referance :
it means sending sending the address of variable to the
called function means a user can send the address of variable.
Is This Answer Correct ? | 181 Yes | 65 No |
Answer / maqbul
call by value :
call by value means programmer send some value coping from
one function to another.At the time of function calling a
programmer can send a copy of variable of value.
call by referance :
it means sending sending the address of variable to the
called function means a user can send the address of
variable.
Is This Answer Correct ? | 109 Yes | 33 No |
Answer / shikesho padjowike
call by value is a technique whereby the called function
receives value from its calling function, stores this value
in its local arguments andd return a result.
call by reference is a technique whereby a calling gives
access of its local variables to the called function.
Is This Answer Correct ? | 96 Yes | 27 No |
Answer / dhiren
IN CALL BY VALUE, BOTH THE ACTUAL AND FORMAL PARAMETERS
WILL BE CREATED IN DIFFERENT MEMORY LOCATIONS WHEREAS IF
THEY ARE CALLED BY REFERENCE BOTH WILL BE CREATED AT THE
SAME LOCATION ANDit is sending the address of variables to the called function .
Is This Answer Correct ? | 77 Yes | 28 No |
Answer / soumya.tavildar
call by value :
The copy of the argument is passed. e,g., if x and y are arguments and their corresponding values are say 100 and 200.
c=max(x,y);
max(inta,intb)
call by referance :
it is sending the address of variables to the called function.
Is This Answer Correct ? | 89 Yes | 41 No |
Answer / sadikhasan
Call By Value :
In call By Value it create different memory for local
variable and actual called Variable. so changes does not
affect to the actual variable.
Call By Reference:
In call By Reference Compiler create same memory location
for the local variable and actual called variable so changes
affect to the actual variable and modify the value of actual
called Variable.
Is This Answer Correct ? | 43 Yes | 12 No |
How to find the return code of a statement in abap programs?
How is time management and payroll is integrated? : sap abap hr
in real time with the help of scripts what we can do?
We created ZEMP table now i want to add more data but previous data should not disturb how can i do this?
Processing data from data base?
What has to be done to the packed fields before submitting to a BDC session.
What is the use of info groups? : sap abap hr
What is the syntax of packed number?
can we create secondary index for views?
By default SAP provides locking mechanism if db is being used by a user ,then what is the use of writing enque method in your code?
Explain the use of table maintenance allowed?
What are the output type and Tcodes?