Skip to Main Content
Sams Teach Yourself C++ in 24 Hours, fifth edition
book

Sams Teach Yourself C++ in 24 Hours, fifth edition

by Jesse Liberty, Rogers Cadenhead
April 2011
Beginner content levelBeginner
464 pages
9h 18m
English
Sams
Content preview from Sams Teach Yourself C++ in 24 Hours, fifth edition

Hour 7. Storing Information in Arrays and Strings

What Is an Array?

An array is a collection of related data that all have the same data type. An array can be envisioned as a series of data storage locations. Each storage location is called an element of the array.

An array is declared by writing the data type and the array name followed by the number of elements the array holds inside square brace. Here’s an example:

long peaks[25];

The peaks array holds 25 long integers. This declaration causes the compiler to sets aside enough memory to hold all 25 elements. Because each long ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Sams Teach Yourself C++ in 24 Hours, Sixth Edition

Sams Teach Yourself C++ in 24 Hours, Sixth Edition

Rogers Cadenhead, Jesse Liberty

Publisher Resources

ISBN: 9780672331855Purchase book