(If you are used at pointers and absolutely want to know what happens,simply think double &b = a is translated to double *b = &a and allsubsequent b are replaced by *b.) The value of REFERENCE b cannot bechanged afther its declaration. For example you cannot write, a fewlines further, &b = c expecting now b IS c. It won't work. Everythingis said on the declaration line of b. Reference b and variable a aremarried on that line and nothing will separate them.

References can be used to allow a function to modify a calling variable:

#include <iostream.h>

void change (double &r, double s){r = 100;s = 200;}

void main (){double k, m;

k = 3;m = 4;

change (k, m);

cout << k << ", " << m << endl; // Displays 100, 4.}

If you are used at pointers in C and wonder how exactlythe program above works, here is how the C++ compiler translatesit (those who are not used at pointers, please skip this ugly piece of code):