KnowledgeBoat Logo
|

Computer Applications

Write a function that interchanges the value of two integers A and B without using any extra variable.

User Defined Methods

13 Likes

Answer

void swap(int a, int b)   {
    a = a + b;
    b = a - b;
    a = a - b;
}

Answered By

7 Likes


Related Questions