-
A.
No solution exist.
-
B.
Solution need 2 extra variables
-
C.
Solution exist without any extra variables
-
D.
Solution need 1 extra variable
Correct Option: CExplanation: Solution c Solution exist without any extra variables
1.
void swap(int a, int b)
{
int c;
c=a;
a=b;
b=c;
}
2.
void swap (int a, int b)
{
a=a+b;
b=a-b;
a=a-b;
}
Solution2 is the best solution since no extra variable is required.