Array Index Out of Bounds

Why do we get this error?.what is meaning of this error?

@varun5,

Arrays are 0 indexed, that means that an array with 3 elements will have elements at indexes 0, 1, and 2.

3 is out of bounds, so when you try to access pos[3] or len[3], your program will thrown an exception.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.