Why does array indexing in Java start with 0?

Java uses zero-based indexing because c uses zero-based indexing. C uses zero-based indexing because an array index is nothing more than a memory offset, so the first element of an array is at the memory it’s already pointing to, *(array+0).

See also Wikipedia’s array indexing in different languages?

Leave a Comment