Swap Using Reference
You are given two integers A and B.
Implement a function named swapValues that:
- Takes two integers A and B as a reference variables parameters
- Swaps the values of A and B
Note: The output will be handled in driver code.
Example 1:
Input: A = -5, B = 10
Output: 10 -5
Explanation:
A = -5, B = 10, after swap the value of A = 10, B = -5
Example 2:
Input: A = 3, B = 7
Output: 7 3
Explanation:
A = 3, B = 7, after swap the value of A = 7, B = 3
Now Your Turn!
Pick the correct output for the given inputInput: A = 0, B = -10
Still unsure what the problem is asking ?
Let’s go through a few more examples, step by step, to make it clearer.
Constraints:
- -100 <= A, B <= 100