207k views
0 votes
What is the last valid index in an array with a given length?.

User Luben
by
3.2k points

1 Answer

10 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 Alireza Sobhani
by
3.7k points