< Previous | Contents | Next >
1. Write a program with a pointer to a pointer to a string object. Use the pointer to the pointer to call the size() member function of the string object.
2. Rewrite the final project from Chapter 5, the Mad Lib game, so that no string objects are passed to the function that tells the story. Instead, the function should accept pointers to string objects.
3. Will the three memory addresses displayed by the following program all be the same? Explain what’s going on in the code.
Exercises 253
#include <iostream> using namespace std;
int main()
{
int a = 10; int& b = a; int* c = &b;
cout << &a << endl; cout << &b << endl; cout << &(*c) << endl;
return 0;
}
This page intentionally left blank