Several times during the discussion about programming, I came to a misunderstanding caused by different ideas about how consecutive elements of an array based on zero relate to the use of ordinal numbers. There seem to be two opinions on this:
a[0] = "first"; a[1] = "second"; a[2] = "third;
against
a[0] = "zeroth"; a[1] = "first"; a[2] = "second";
I always preferred the former, knowing that the element "n-th" is an "element of index n-1". But I was surprised how many people found that they were intuitive and used the latest version.
Is one of these conventions more correct than the other? What should I use during discussion or documentation to avoid misunderstandings?
language-agnostic arrays terminology conventions documentation
Kos
source share