What is the output of the following code value of a and valu
     What is the output of the following code (value of a and value of b)?  voidfuncl(lnt*p1, int.p2)  {int temp;  temp = * p1;  *p1 = *p2;  *p2 = temp;}  int main()  {int a = 10, b = 20;  func1(&a;, &b;);  cout  
  
  Solution
The output of above code is as follows
value of a is 20
value of b is 10
Explanation:
Initially value of a =10 and b=20
The funct1() is called by address, Address of a and address of b are passed to funct1()
In the called function the formal arguments are pointer p1 and p2.
P1 points to the address of a , and p2 points to the address of b.
Here a swap operation is performed that exchange the values of a and b throuhthier address. So as arguments are passed by address, changes in the formal argument also reflects in the actual arguments.
SO a is now 20 and bis now 10.

