C++ Array Basics
Array Basics
An array is a collection of items that are of the data type stored in contiguous memory locations. And it is also known as a subscript variable.
It can even store the collection of derived data types such as pointers, structures, etc.
An array can be of any dimension. The C++ Language places no limits on the number of dimensions in an array. This means we can create arrays of any number of dimensions. It could be a 2D array or a 3D array or more.
Advantages of Arrays?
It is used to represent multiple data items of the same type by using only a single name.
Accessing any random item at any random position in a given array is very fast in an array.
There is no case of memory shortage or overflow in the case of arrays since the size is fixed and elements are stored in contiguous memory locations.