O'Reilly logo

Sams Teach Yourself C++ in 24 Hours, Third Edition by 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

What Is an Array?

An array is a collection of objects, all of the same type. An array can be envisioned as a series of data storage locations; each storage location is called an element of the array.

You declare an array by writing the type, followed by the array name, a left brace, the subscript, and a right brace. The subscript is the number of elements in the array surrounded by square brackets. For example,

long LongArray[25];

declares an array of 25 long integers, named LongArray. When the compiler sees this declaration, it sets aside enough ...

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