Re: Why do programmers start counting from 0?

From: <apdicaprio_at_gmail.com>
Date: 9 Dec 2004 15:08:51 -0800
Message-ID: <1102633731.369524.43680_at_f14g2000cwb.googlegroups.com>


Wasn't really for speed or space. With memory management, when you create an array, the indexer just does pointer arithmetic. so for an array of 10 ints, you set aside 40 bytes of memory. [0] will give you the starting memory address of the array + 0 * sizeof(int). [1] will give you 1 * sizeof(int) or 4 and so on. Received on Fri Dec 10 2004 - 00:08:51 CET

Original text of this message