Difference Between Call By Value and Call By Reference?
Answer Posted / 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 |
Post New Answer View All Answers
What is the basic difference internal tables and database tables? : abap data dictionary
What is a function group? : abap modularization
What is the disadvantage of a call by reference?
What is the differrences between structure and table in data dictionary in abap? : abap hr
What is the difference between a pool table and a transparent table and how they are stored at the database level?
What are the function module in bdc?
Can i have some Realtime Scenarios on Reports.
What are the function modules used in f4 help?
What are the disadvantages of abap query tool?
When value table becomes check table?
What function does data dictionary perform?
What are the time related infotypes? : abap hr
What are the two ways for restricting the value range for a domain? : abap data dictionary
What kind of deliverables you have on a day to day basis?
What are pooled tables? : abap data dictionary