Functions Q.6

0. int a =1 , b=2;

a=chg(b) ;

cout << a << b ;

If the function chg is coded as


int chg(int &x)
{

x = 10;

return ();

}

then   Functions

  • Option : D
  • Explanation : Here the parameter passing mechanism is pass by reference. Any change done to the parameter will be reflected outside the function. So, the value of b, after the exit of the function will be 10.
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *