what is code for call by value and call by reference?



what is code for call by value and call by reference?..

Answer / anilkumar.s

#include<iostream.h>
class call
{int a,b;
void callbyvalue(int x,int y)
{ a=x;
b=y;
int c;
c=a;
a=b;
b=c;
}
void callbyreference(int *x,int *y)
{
a=x;
b=y;
int *t;
t=a;
a=b;
b=t;
}
void display()
{
cout<<" a=" <<a<<" "<<"b="<<b;
}
void main()
{
call o;
o.callbyvalue(10,20)//value can't be swap
o.callbyreference//value can be swaP

Is This Answer Correct ?    7 Yes 1 No

Post New Answer

More OOPS Interview Questions

what is Class in oops with example?

4 Answers   HCL,


Write a program to reverse a string using recursive function?

1 Answers   TCS,


write a program for function overloading?

14 Answers   HCL, InfoCity, TATA,


wht is ditch

0 Answers  


What is the main purpose of inheritance law?

1 Answers  


design class for linked list and include constructor,destructor,insert option. node of form struct node { int data; struct node &ptr; }

0 Answers  


When is it necessary to use member-wise initialization list in C++?

2 Answers   Adobe,


what is the difference between inter class and abstract class...?

0 Answers  


How to hide the base class functionality in Inheritance?

1 Answers   Viscus Infotech,


What is encapsulation in simple terms?

1 Answers  


program for insertion ,deletion,sorting in double link list

1 Answers  


how to find the correct email address format by using the programe?

1 Answers   Accenture,


Categories