Earlier quoted context omitted.
> when we count, we start at 1, we talk about the "1st" Although often with an implicit zero. Under typical North American culture, your 1st birthday, for example, is more accurately the first anniversary of your birthday. Your birth is zero indexed.
No, birthdays are 1 indexed. Your Nth birthday is the day you turn N years old. When you're 1 year old, you've been alive for 1 year, not 2 years.
Why do arrays start at 0?
31–40 of 702 posts
Re: Why do arrays start at 0?
#32Something like the following IIRC: Type IntArray = Array [-10...10] of Integer;
Re: Why do arrays start at 0?
#33It really comes down to a choice between a machine-focused (0) or human-focused (1) approach. The 0 makes a lot of sense in a C pointer world where memcpy and other alike functions can be written very thight. The 1 makes a lot of sense in a human world, when we count, we start at 1, we talk about the "1st", counting on finger starts with 1, etc. I once were at a Lua (1 indexed language) conference where this was disc…
Maybe distances should be human-focused, so that no displacement is equivalently expressed as 1 cm, 1 m, 1 km, ...
Then converting a distance d from m to cm is (d - 1) x 100 + 1.
Re: Why do arrays start at 0?
#34Re: Why do arrays start at 0?
#35It really comes down to a choice between a machine-focused (0) or human-focused (1) approach. The 0 makes a lot of sense in a C pointer world where memcpy and other alike functions can be written very thight. The 1 makes a lot of sense in a human world, when we count, we start at 1, we talk about the "1st", counting on finger starts with 1, etc. I once were at a Lua (1 indexed language) conference where this was disc…
Just think of 0-based as offset-based and 1-based as index-based. Both are intuitive just like that. I never get why people arguing over this bring pointers and memory (or anything computer related) to the table. No normal person is going to understand that, but everyone understands that if you don't move at all (0 offset) you stay at the first (index 1) item. Add one and ... you get the point.
Re: Why do arrays start at 0?
#36Earlier quoted context omitted.
> when we count, we start at 1, we talk about the "1st" Although often with an implicit zero. Under typical North American culture, your 1st birthday, for example, is more accurately the first anniversary of your birthday. Your birth is zero indexed.
No, birthdays are 1 indexed. Your Nth birthday is the day you turn N years old. When you're 1 year old, you've been alive for 1 year, not 2 years.
Your first birthday is the first anniversary of your birth day.
We celebrate the anniversaries of our birth day.
Re: Why do arrays start at 0?
#37Earlier quoted context omitted.
No, birthdays are 1 indexed. Your Nth birthday is the day you turn N years old. When you're 1 year old, you've been alive for 1 year, not 2 years.
The moment you are born you are 0 years old (or perhaps 0.75 years old, but we don't usually recognize that). We count from zero in this case, at least implicitly. In some cultures you are considered 1 the moment you are born, so the zero indexing isn't universal here, but typical in North America as noted earlier.
Re: Why do arrays start at 0?
#38Earlier quoted context omitted.
The moment you are born you are 0 years old (or perhaps 0.75 years old, but we don't usually recognize that). We count from zero in this case, at least implicitly. In some cultures you are considered 1 the moment you are born, so the zero indexing isn't universal here, but typical in North America as noted earlier.
No, we don't count from 0. That's like saying we start counting a baker's cup from 0 because you can have half a cup.
Re: Why do arrays start at 0?
#39 a[z * h * w + y * w + x]
But with 1-based indexing you need to substract one first from each component except the last: a[(z - 1) * h * w + (y - 1) * w + x]Re: Why do arrays start at 0?
#40"When dealing with a sequence of length N, the elements of which we wish to distinguish by subscript, the next vexing question is what subscript value to assign to its starting element. Adhering to convention a) yields, when starting with subscript 1, the subscript range 1 ≤ i https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/E...