//Author: Justin C. Miller 
// pass by reference vs. by value

void PassByValue(int, int) ;
void PassByReference(int&, int&) ;

// passing by value will change nothing in main!!!!
// by simply adding & you are now passing by reference
// thus any changes will affect the variables in main!!!!

int main()
{
	int a = 3, b =4 ;
	cout << a << " " << b << endl ;  // a = 3, b =4
	PassByValue(a, b) ;
	cout << a << " " << b << end ;  // a still = 3, b still = 4
	PassByReference(a, b) ;
	cout << a << " " << b << endl ; // a is now 5, b is now 7

	return 0
}

// value just makes a copy of a and b
void PassByValue(int a, int b)
{
	a = 5 ;  // these are copies of a and b
	b = 7 ;  // they have to affect on the a and b in main
}

// reference uses the actual variables a and b that were passed
// to the function
void PassByReference(int& a, int &b)
{
	a = 5 ;  //this is the same a that's in main
	b = 7 ; // this is the same b that's in main
}