Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Does 1-based indexing have any advantage, beyond familiarity to scientists?



With 1-based indexing, length == last index.

Does 0-based indexing have any advantage, beyond ability to do pointer arithmetic with indexes?


In 0-based indexing, n % length is a value inside the range.


Not really, but it's not important either way.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: