0
Is there a way of starting an array's index from 1 instead of 0?
3 Respuestas
+ 3
Look at a centimeter measure - the first cm starts with 0 and ends with 1.
Arrays are just the same.
+ 2
No, there is nothing you can do about it.
You could do index + 1 but then you're just wasting space.
Lua starts at 1 though, but then again, it doesn't really use arrays but tables instead.
Don't worry, you'll get used to it.
+ 2
Matlab uses array indexing starting from 1.
But the vast majority of programming languages index from 0