C++ Demystified(c) A Self-Teaching Guide

Overview

Recently, while in a crowded room, someone yelled Hey, you! I and a number of other people looked up, because none of us could tell to whom the speaker was referring. Had the speaker instead yelled Hey, Jeff Kent!, I would have known he was calling me (unless of course there happened to be another Jeff Kent in the room).

We use names to refer to each other. Similarly, when you need to refer in code to a particular item of information among perhaps thousands of items of information, you do so by referring to the name of that information item.

You name information by creating a variable. A variable not only gives you a way of referring later to particular information, but also reserves the amount of memory necessary to store that information. This chapter will show you how to create variables, store information in them, and retrieve information from them.

Категории