//ref1.cpp
#include <stdio.h>

void foo(int i, int *ip, int &ir)	{
	i = 3;	//no impact to caller - passed by value
	*ip = 4;	//new value passed back to caller - passed by address
	ir = 5;	//new value passed back to caller - passed by ref
}

main()
{
   int i = 3;
   int &ir = i;
   printf("%d, %d, %#x, %#x\n",i,ir,&i,&ir);

	foo(i,&i,i);
   printf("%d, %d, %#x, %#x\n",i,ir,&i,&ir);
}

/*** output *************
3, 3, 0x2200, 0x7957
5, 5, 0x2200, 0x7957
*************************/


