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 a help view? : abap data dictionary
What is the difference between commit-work and rollback-work tasks?
What are the main events of which are used for logical database?
What are aggregated objects : abap data dictionary
What is smart forms? : abap hr
A field containing currency amounts (data type curr) must be assigned to a reference table and a reference field. Explain?
What are the advantages of different types of bdc's?
What is the significance of technical settings (specified while creating a table in the data dictionary)? : abap data dictionary
how to create module pool program using table controls based on selection criteria specified for sales document item in the first screen and item details in the second screen. plz mention the detail coding Tahnks, Rahul
How do you restrict the data to be entered in the payroll area? : sap abap hr
What is time constraint ? : abap hr
What are the different types of operators in the sap abap?
What is meant by slab? How is indian slab and us slab? : sap abap hr
What is payroll driver ? : abap hr
How collect statement is different from append?