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
Of the two call transaction and session method, which is faster?
Explain the types of bdc's?
Does sap handle multiple currencies?
Explain get pernr concept when we use logical data base? : abap hr
Can we use transfer dataset to transfer data in internal table ?
What are the layers of data description in r/3? : abap data dictionary
What type of user exits have you written ?
Print options in smartforms?
Abstract class and interface, multiple inheritance, live example
Can we call reports and transactions from interactive reporting lists?
What are the two ways for restricting the value range for a domain? : sap abap data dictionary
What is protect & endprotect?
Difference between .Include and .append?
What is table buffer?
Is the basic list deleted when the new list is created?