Exercise 2.15
(b) The reference must be an object and cannot be a literal value
(d) The reference must be initialized and bound to the object
Exercise 2.16
(a) Assign the value of d bound to r2 to 3.14159
(b) Assign a reference of type
double to a value of type int (c) Assign a value of type double to int type, data will be lost
(d) Reference of double type will Value is assigned to int type, data will be lost
Exercise 2.17
#include<iostream>
int main()
{
int i, & ri = i;
i = 5;
ri = 10;
std::cout << i << " " << ri << std::endl;
}
10 10