You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Vaidhyanathan S M edited this page Apr 11, 2021
·
1 revision
Arrays
An array is a collection of items stored at contiguous memory locations. The elements of an array are of same data type. Each element of an array is identified by using index (or position) in that array.
For example:
Consider the array given below:
[1,2,3,4,5]
The element '1' is at position 0 while the element '4' is at position 3.
Advantages of using arrays:
Arrays allow random access of elements. So it makes accessing elements by position faster.
Arrays have better cache locality which forms a significant factor in improving performance.