O'Reilly logo

Sams Teach Yourself C++ in 24 Hours, fifth edition by Rogers Cadenhead, Jesse Liberty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required