368,767 views
41 votes
41 votes
What happen when a beginning programmer forgets that array subscripts start with 0?

User Krishnaxv
by
2.6k points

1 Answer

13 votes
13 votes

The first element of the array is exactly contained in the memory location that array refers (0 elements away), so it should be denoted as array[0] . Most programming languages have been designed this way, so indexing from 0 is pretty much inherent to the language.

User Yuklia
by
2.5k points