Hour 3. Creating Variables and Constants

What Is a Variable?

A variable is a location in computer memory where you can store and retrieve a value. Your computer’s memory can be thought of as a series of cubbyholes lined up in a long row. Each cubbyhole is numbered sequentially. The number of each cubbyhole is its memory address.

Variables have addresses and are given names that describe their purpose. In a game program, you could create a variable named score to hold the player’s score and a variable named zombies for ...

Get Sams Teach Yourself C++ in 24 Hours, fifth edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.