Avatar

I blame Java. ;-) (Destiny)

by Xenos @, Shores of Time, Saturday, August 27, 2016, 12:43 (2799 days ago) @ ZackDark

I blame C. Who the hell starts a list at index 0, you silly assembly wizards?

Almost everyone, not just C. It's because it makes it easier to calculate the range of an array. If you start at 1 you have to subtract 1 every time you want to find the range of an array, but if you start at 0 you don't. Considering 99.999% of people will never see an array anyway it makes sense to make it easier to program form, not to mention when the precursor of C (BCPL I think?) was written I'm positive that one less operation probably made a very significant difference in efficiency.

Edit:
Also here's a good answer on why they even use 0-11 instead of 1-12 for months: http://stackoverflow.com/a/18002968


Complete thread:

 RSS Feed of thread