Re: Why do programmers start counting from 0?
Date: Mon, 13 Dec 2004 18:12:16 -0600
Message-ID: <cplb54$b8c$1_at_news.netins.net>
"Tore" <tore.trollsaasXATX_at_skedsmo.online.no> wrote in message
news:d8snr01h9isckvs96au62jflgcjpvtmut0_at_4ax.com...
> On 8 Dec 2004 19:07:20 -0800, timothychung_at_gmail.com wrote:
>
>>One day, I started wondering why we start counting from 0 and couldn't
>>find a good search string to get much out from google.com. Can anyone
>>help me?
>>
>>One of the advantage I can think of is modulus of that number gives a
>>more organised result.
>>
>>Or is it just because of binary representation of our number?
>>Please help. Thanks. :)
>
> Believe this is the answer...
> In the old assembler days, elements in an arrays were referenced by
> start-of-array-address and and offset value. Offset = 0 obviously
> pointing to start of the first element in the array.
Sounds very plausible -- I'll switch my vote to your answer.
> This technique was inherited by most of the machinecode-near or
> academic/university developed languages and then carried on from
> there.
> Other, more business related languages, started counting from 1.
Counting from zero is sometimes a pain, but not knowing whether the language you are reading or writing at any given time is working with 1 or 0 as the first element in the array is even more painful (although such confusion is less frequent prior to the age of 40). --dawn
> Regards Tore
Received on Tue Dec 14 2004 - 01:12:16 CET
