you're passing x and y into the swap function by value, which means a copy is made of them and those copies are the only things which are swapped, not the original values.
Hehe I suppose that's true. It doesn't even matter as this is a rather trivial task. The only time I can think of where swapping variables would be necessary is when sorting an array, and there are plenty of library functions for that.