Skip to main content

13.8) Exercise 21


Open the provided file swap.cpp in your text editor and study it. The program is supposed to swap the two integers values that are passed to it. Compile and run the program. What happens?

Now modify the first line of the function definition so it looks like this:

void swap(int& x, int& y)

Recompile the program and run it again.