O'Reilly logo

Just Enough C/C++ Programming by Guy W. Lecky-Thompson

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

Arrays

An array is a dimensional information store. A variable contains one piece of information, whereas an array contains more than one piece of information of the same type. Types (numbers, letters, and user-defined types) cannot be mixed within an array.

However, user-defined complex types can be contained in an array, allowing you to store multiple objects with a variety of data, side by side. Arrays can be one dimensional or multidimensional. A one-dimensional array is rather like a row of boxes in memory, into which you can place values.

You can define a one-dimensional array thus:

int nIntegerArray[10];

This example declares a variable of type integer that can contain 10 individual numbers, one after the other.

A two-dimensional array, ...

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