Reference Variable
From WikiKantila
/* Purpose : To show the usage of reference variable
* Written by : Nitun
* Dated : 21 April 2008
*/
#include <iostream>
using namespace std;
int main()
{
int x=100;
//reference variable declaration
int& y=x;
cout<<"Address of x is = "<<&x<<" and that of y is = "<<&y<<endl;
cout<<"Value of x is = "<<x<<endl;
y=200;
cout<<"Value of x is = "<<x<<endl;
return 0;
}
Go back to C++ Programs

