//Explore Pass by Value and pass by reference

#include <iostream>
using namespace std;
void swap(int & x, int & y);


//EXERCISE: write a function that swaps two values swap(x,y);
//Explore pass by reference

#include <iostream>
using namespace std;

int main(void)
{
	int x = 1;
	int y = 5;

	cout << "x is " << x << " y is "<< y << endl;
	swap(x, y);
	cout << "x is " << x << " y is " << y << endl;
	return 0;
}

//swaps contents of a and b
void swap(int & a, int & b)
{
	int temp; //local variable - exists only in the function.  local scope
	temp = a;
	a = b;
	b = temp;
}