Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
-vim-31257ySome people say it’s stupid to start at 0, but no, it’s intelligent!
You have a better range (256 instead of 255 in case of a byte)
It’s natural for thing to start with 0, cause that is actually the first natural number
It’s actually the number the reader/writer has to advance:
So you start at index 0 and then you make +3 and advance to index 3
Anyway, it’s just that people think of first, second, third etc. when it’s not what they should think of in an array -
-
@-vim- Well I think that is what he just explained with his rant.
And from when is 0 a natural number.. 😂😂 -
-vim-31257y@MadhurBansal @asknavdeep well idk, but that was what I was taught and according to Wikipedia, ISO thinks the same
-
sSam14837y@-vim- using 0 or 1 as starting index doesn't influence range, if you wanted you could use byte for indexing and start your index from 520 and still store 256 elements, just when compiling: index-=520.
But like you said the reason why indeces start from 0 is because indeces translate to offset and starting from 0 is natural.
Related Rants
RIP *****
rant
programming
errors
wk99
savage
devs