I want you to write a function that swaps two integers. The function signature should be void swap(int& a, int& b). Inside, you'll need a temporary variable to hold one value while you swap them.
Test your function with two variables: int x = 5, y = 10. After calling swap(x, y), x should equal 10 and y should equal 5. Print both to verify. This problem shows why pass by reference matters.
If you used regular parameters void swap(int a, int b), the swapping would happen on copies and the originals wouldn't change. References give you direct access to the caller's variables.