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
What is the role of a return statement in a method ?
What are the three types of functions in Java?
Give the prototype of a function check which receives a character ch and an integer n and returns true or false.
Write a function that takes an int argument and doubles it. The function does not return a value.