C++ examples for Data Type:Reference
Create double type reference as alias for a variable
#include <iostream> using namespace std; int main()//from w ww . j a va 2s . c o m { double total = 20.5; // declare and initialize total double& sum = total; // declare another name for total cout << "sum = " << sum << endl; sum = 18.6; // this changes the value in total cout << "total = " << total << endl; return 0; }