Should Arrays Start at 1?

Arrays should start at 1 because as people count starting from one. The thing with 0-based indexing is that you always then have to write code of the type for i=0:len(a)-1 when iterating.

Can an array start at 1?

All arrays are 0-origin. An array with length n can be indexed by the integers 0 to n-1. You can't do that as array index in Java starts from 0. But you can access array with index 1 with little modifications.

Do arrays in C start at 1?

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] .

Elena Rostova

Elena Rostova

Lead Health, Wellness & Medical Journalist

Elena Rostova holds a Master's degree in Public Health Journalism. She covers groundbreaking medical research, holistic wellness trends, mental health awareness, and nutritional science.