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

c++ program to swap the objects of two different classes

0 Answers  


What are the fields of vtable

1 Answers   Mphasis,


What is a scope operator and tell me its functionality?

3 Answers   emc2,


what is difference between String s=new String("vali"); String s="vali"

1 Answers  


Can you inherit a private class?

0 Answers  






What does sksksk mean in text slang?

0 Answers  


Get me an image implementation program.

0 Answers  


What is the expansion of OOPS?

24 Answers   TCS,


What polymorphism means?

0 Answers  


What is ambiguity in inheritance?

0 Answers  


What is multilevel inheritance?

0 Answers  


i=20;k=0; for(j=1;k-i;k+=j<10?4:3) { cout<<k; } //please comment on the output

0 Answers  


Categories