Accessing Array Elements
1 min read ·
Accessing Array Elements
Index Based Access
Array elements are accessed using their index positions.
Indexing starts from zero.
This accesses the first element of the array.
Positive Indexing
Positive indexes access elements from the beginning of the array.
Index values increase from left to right.
Negative Indexing
Negative indexes access elements from the end of the array.
Negative indexing is useful when the position from the end is required.