If function t is called what is printed void r(int x ,int y, int &z) { cout <<"r:x="<<x<<"y=",,y <<"z=",,z,,endl; x=x+1; z=y+x; } void t() { int a,b,x; a=20; b=25; x=250; r(a,b,x); r(x,a,b); cout<<"t:a"<<a<<"b="<<b <<"x="<<x<<endl; }

This question is related to Wipro Interview

Showing Answers 1 - 1 of 1 Answers

purani86

  • Jun 18th, 2006
 

If function t is called what is printed void r(int x ,int y, int &z)
{
cout <<"r:x="<<x<<"y=",,y
<<"z=",,z,,endl;
x=x+1;//has no meaning since x is local to fn
z=y+x;//has no meaning since z is local to fn

}
void t()
{
int a,b,x;
a=20;
b=25;
x=250;
r(a,b,x);
r(x,a,b);
cout<<"t:a"<<a<<"b="<<b
<<"x="<<x<<endl;
}

result will be

20 25 250

250 20 25

20 25 250

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions