< Previous | Contents | Next >

Accessing Referenced Values

Next I send both myScore and mikesScore to cout.

cout << "myScore is: " << myScore << "\n";

cout << "mikesScore is: " << mikesScore << "\n\n";

Both lines of code display 1000 because they each access the same single chunk of memory that stores the number 1000. Remember, there is only one value, and it is stored in the variable myScore. mikesScore simply provides another way to get to that value.