25 ms·
Yeah, I don't get the love for 0 base, unless you're doing C level stuff, which is the real reason for 0 based indexing.
by goatlover 10y ago
Yeah, I don't get the love for 0 base, unless you're doing C level stuff, which is the real reason for 0 based indexing.
- avian 10y agoI guess it depends on the field you're working with. I'm definitely more at home with 0-based languages, although at this point I have worked a lot with MATLAB/Octave code as well. In my case, it is very common that i-th element in an array is somehow related to say (x0 + i*dx). This fits naturally with 0-based indices. With 1-based indices you tend to have (i-1) or (x0-dx) everywhere. It gets extremely annoying when people get clever and rearrange this -1 in equations. Then it is no longer clear what is there as a side effect of the indexing and what is perhaps some constant in the numerical method.