Swapping function implemented using reference variables.