# ISRO | ISRO CS 2020 | Question 26

• Last Updated : 04 Sep, 2020

What is the output in a 32 bit machine with 32 bit compiler ?

 `#include `` ` `rer(``int` `**ptr2, ``int` `**ptr1)`` ``{``  ``int``* ii;``  ``ii = *ptr2;``  ``*ptr2 = *ptr1;``  ``*ptr1 = ii;``  ``**ptr1 *= **ptr2;``  ``**ptr2 += **ptr1;`` ``}``void` `main( )`` ``{``   ``int` `var1 = 5, var2 = 10;``   ``int` `*ptr1 = &var1, *ptr2 = &var2;``   ``rer(&ptr1, &ptr2);``   ``printf``(“%d %d “, var2, var1);`` ``} `

(A) 60 70
(B) 50 50
(C) 50 60
(D) 60 50

Explanation: Under rer functions:

```ptr2 = 3000 ptr1 = 4000

ii = 1000

*(3000) = *(4000)
i.e., outer ptr1 = 2000

*(4000) = 1000
i.e., outer ptr2 = 1000

**ptr1 *= **ptr2
will convert var1 = 50

**ptr2 += **ptr1
will convert var2 = 60 ```

Hence, 60 50 gets printed.

 `#include  ``   ` `int` `rer(``int` `**ptr2, ``int` `**ptr1) `` ``{ ``  ``int``* ii; ``  ``ii = *ptr2; ``  ``*ptr2 = *ptr1; ``  ``*ptr1 = ii; ``  ``**ptr1 *= **ptr2; ``  ``**ptr2 += **ptr1; `` ``} ;``  ` `int` `main( ) `` ``{ ``   ``int` `var1 = 5, var2 = 10; ``   ``int` `*ptr1 = &var1, *ptr2 = &var2; ``   ``rer(&ptr1, &ptr2); ``   ``printf``(``"%d %d "``, var2, var1); `` ``}  `

Option (D) is correct.

Quiz of this Question

My Personal Notes arrow_drop_up