swap function with reference parameters