Declaring a Built-In Array

To specify the type of the elements and the number of elements required by a built-in array, use a declaration of the form:

type arrayName[ arraySize ];

The compiler reserves the appropriate amount of memory. The arraySize must be an integer constant greater than zero. For example, to tell the compiler to reserve 12 elements for built-in array of ints named c, use the declaration

int c[ 12 ]; // c is a built-in array of 12 integers

Get C++11 for Programmers, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.