News for hackers. Stuff that matters.
Re:Edsger Dijkstra's note on starting array indices at 0 (pd... by gaius on Wednesday June 22, 2011 @08:49AM (#2682856)
I said this yesterday, but the way an array works is you get a pointer to its first item + (size of an item * index) to get a pointer to the item you want. The first item is the pointer + 0. So that's why it's like that.

FWIW I grew up on FORTRAN which starts from 1 and work with PL/SQL now which also starts from 1, so I am used to it, but I understand why it makes sense to do it from 0 in terms of the way computers actually work. At least, computers with operating systems written in C.

There are no comments on this comment yet.