References are aliases, i.e. alternate names for another variable.
They are not allocated any storage. They are required to be
initialized when they are declared. Here is how to declare
to be a reference to
double &g = a;
The type declaration
double & specifies a reference to a
double. Please notice that the ampersand is being used in a different
context here. That is, it is being used in a declaration.
Suppose, we now write
g = -1.7;
g is just another name for
a this means the same
a = -1.7;
Please note, we do not recommend writing your code this way! It would
be very confusing to have two names for the same variable in the same
block of code. So you will see references used primarily for passing
values back and forth between programs and subprograms.