Question: #include using namespacestd; voidswapValue(int,int); voidswapReference(int&,int&); intmain () { inti =10,n = 20; swapValue(i, n); cout <

#include

using namespacestd;

voidswapValue(int,int);

voidswapReference(int&,int&);

intmain ()

{

inti =10,n = 20;

swapValue(i, n);

cout<

i =10,n = 20;

swapReference(i, n);

cout<

return0; }

voidswapValue(inta,intb)

{

inttemp = a;

a =b ;

b = a; }

voidswapReference(int&a,int&b)

{

inttemp = a; a = b;

b = temp;

}

  1. a)What is the output of the cout statement 1 above?
  2. b)What is the output of the cout statement 2 above?
  3. c)Briefly explain your answer to questions (a) and (b) ?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!