CJCoding With Joseph

Swap With Ref Method

Write the void static method Swap using two ref int parameters so it exchanges the values of the two variables passed to it. The tester swaps x and y, then prints them separated by a space. Do NOT write a Main method.

Starting from x = 3 and y = 8, after Swap(ref x, ref y) the program prints exactly:
8 3

Expected Output:

8 3
Topics:
Methods
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (cw, cr, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.