149k views
5 votes
For an array of size N what is the range of valid indices (or subscripts)?

1 Answer

2 votes

Answer:

The valid range is 0 to N - 1

Step-by-step explanation:

Required

Valid range of an array of size N

The index of an array starts from 0, and it ends at 1 less than the size.

Take for instance:

An array of size 4 will have 0 to 3 as its indices

An array of size 10 will have 0 to 9 as its indices

Similarly,

An array of size N will have 0 to N - 1 as its indices

User Stephen Reindl
by
4.2k points