The element at offset 0 is the first element.
Precision in naming is important.
The element at offset 0 is the first element.
Precision in naming is important.
It's also a definition commonly used in math, through not always. It depends a lot of the area of mathematics and even the cultural context.
The only reason we sometimes feel 0-index is wrong IMHO is because the english language describes entities in a sequence as 1st, 2nd, 3rd etc.
But I wouldn't be surprised if there is some human language somewhere which does it differently. Like something which roughly matches to english like "head, head+1, head+2, ...".
Depends which country your building is in, and more!
My apartment building is 1,2… but my mall is G,M,1,2… (same country different architects). For many years I lived in Europe where it’s usually G,1,2… (where G can also be E or Fsz or whatever) and when I was in the US I had to remember that 1 is G, though L,2,3… is also common.
City people live with index ambiguity all the time and our brains manage just fine.
Confused me when I visited USA.
> Confused me when I visited USA
It's applied inconsistently enough to be confusing for natives too!
Do you count the machine floors in high rise buildings?
In AU, the ground floor is effectively "zero", the first floor is the one above ground. Depending on the design of the building, there might be a "mezzanine" floor between ground and 1st.
Basements usually follow the same pattern, so B1 is the first floor below ground etc.
0.5 ... yep that won't work
In some buildings build around 1900 where I live the "ground" floor is not on the ground but around 1/2 a floor above the ground floor. While the cellar is just half below the ground. Because of this the cellar has above ground level windows allowing legal cellar apartments (oversimplified in Germany apartments require windows which are above ground).
This creates a lot of confusion.
By convention this 0.5 floor still counts as ground floor with the floor number 0. But people confuse it all the time for the first floor. Especially if in some cases you do have a few utility rooms exactly at ground floor.
Now things get worse if you live in a cellar apartment in such house: By convention floor -1.
Because nearly everyone will thing you mistyped as normally you legally can't have apartments below the ground floor.
Another fun index ambiguity is for apartments build on a mountain side/cliff.
In this case depending on which side of the house you look at the ground floor might be at, above or below the ground level. Often the floor level with the main entrance counts as ground floor, but sometimes it is not the case and e.g. the lowest floor not below ground or the highest floor even with a "ground".
So yes, index/floor level ambiguity is everywhere and much worse then just is ground floor 0 or 1 ;)
But it's less precise than offset and obviously introduces confusion. Whoever originated the term "0-indexed" should have just suggested we use a better word rather than keeping the inaccurate word (proven by the fact you're currently looking for a way to remove some confusion around the currently chosen word) and prefixing it with a digit, which itself is a confusing thing to do to an English word, thus adding to the confusing while subtracting none.
Also it's not less precise, as there are many different kinds of offsets too. First you have element wise and byte wise and similar offsets, then offsets are inherently relative to something, and that's not always the first element. But could be an offset from the back and I have even seen a offset from one element before the first element in some very unusual use-cases.
It really isn't. The human race gets by without it the vast majority of the time.