3.10 ARRAYS

3.10.1 Introduction

Array is by far the most powerful data structure in any programming language. This is the reason why it is inbuilt in all the higher level languages, old as well as new. We may not find any useful program without using an array.

Array is designed to store many members of a given type in a sequence. These members of an array are referred as elements. Array has a name and an index. Index is enclosed in square brackets. Advantage of arrays is that you can access any array element randomly.

Array declaration

Array is declared as follows:

type <array_name> [ size ]

“type” is any built in or user-defined type except type reference. Every element of an array is of this type. Array_name is the name of an array. Technically, ...

Get Object Oriented Programming with C++, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.