3 ms·
Programmers don't count from 0. Its just in many languages it makes sense like in C where an arrays name is actually a pointer to the first element and the inde
by ndnxhs 8y ago
Programmers don't count from 0. Its just in many languages it makes sense like in C where an arrays name is actually a pointer to the first element and the index says how many positions to move away from it so foo[0] is the pointer to the first element and then move 0 spaces away.
The tradition of starting at 0 just got carried on to everything because having a standard is better than having to memorize what everything uses
- learc83 8y agoThere are good reasons to start counting at 0 beyond convention. Dijkstra wrote a small essay on the topic in 1982 called "Why numbering should start at zero." http://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html http://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EW...
- pjmlp 8y agoAs someone that started programming in languages that count from 1, I kind of disagree with that essay. Specially when dealing with Algol derived languages, where the indexes can be specified in a flexible way.