#include <iostream>
using namespace std;

void f(int &num)
{
	++num;
}

const int& g(int othernum)
// Try removing the "const".  What happens?  Why?
{
	return othernum+3;
	// produces a warning message because it's returning a reference
	// to a "temporary", i.e. a value in memory that may not still
	// exist later
}

int main (void)
{
	int x = 3;
	const int y = 4;
	f(x);
	// Try "f(y);"  What happens?  Why?
	int z = g(5);
	// Try "int &z = g(5);"  What happens?  Why?
	// Try "const int &z = g(5);"  What happens?  Why?
	++z;
}
