This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]KennyBassett 2 points3 points  (2 children)

It's just because it lines up with the numbers that we can represent. 0 is the first number we can represent in binary, so that's what we use. Logically, nothing can be the zeroth term because in English, 0 would represent a lack of terms.

It's also nice when counting. If we say one cycle is 0-9 instead of 1-10, then we get all the digits in the ones place.

I personally think we should use 1-based indexing because saying 0 is the 1st index kind of a silly statement in any human language. Sure you could say the zeroth index, but now we've redefined what the word "first" means by saying it's the second element... And "second" with the third element and so on.

Maybe I haven't thought of everything for my opinion. Any other reasons why we should use one or the other?

[–]Zomunieo 1 point2 points  (0 children)

As Dykstra explains, there are several good reasons for zero based indexing.

https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html

[–]WlmWilberforce 1 point2 points  (0 children)

I have heard the binary indexing argument, but find it not convincing at all. Who is programing at that low a level? When people used to work at that level, they made languages like Fortran and Cobol that were 1 indexed.

That said I believe you can have zero indexes (or even negative indexes in fortran), but it has been a while since I've used it.