474,779 views
2 votes
2 votes
What is the last valid index in an array with a given length?.

User Private
by
3.0k points

1 Answer

15 votes
15 votes

Answer:

length - 1

Step-by-step explanation:

indexes start at 0. so the first value in an index is 0. so the last one would not be the length, it would actually be the length minus 1.

User Uchenna
by
2.8k points