Click here to Skip to main content
15,907,913 members

Survey Results

Should array indexing start at 0 or 1?   [Edit]

Survey period: 7 Mar 2011 to 14 Mar 2011

Old school VB devs and old school C devs know the answer. What's your feeling in this modern, enlightened era?

OptionVotes% 
01,11587.93
115312.07



 
GeneralRe: These results surprise me. Pin
Klaus-Werner Konrad13-Mar-11 2:13
Klaus-Werner Konrad13-Mar-11 2:13 
GeneralHere's why 0-based indices are beautiful: [modified] Pin
Daniel Grunwald7-Mar-11 19:41
Daniel Grunwald7-Mar-11 19:41 
GeneralRe: Here's why 0-based indices are beautiful: Pin
Member 31167107-Mar-11 20:50
Member 31167107-Mar-11 20:50 
GeneralRe: Here's why 0-based indices are beautiful: Pin
MarqW7-Mar-11 21:02
MarqW7-Mar-11 21:02 
GeneralRe: Here's why 0-based indices are beautiful: Pin
Kamran Behzad10-Mar-11 17:10
Kamran Behzad10-Mar-11 17:10 
GeneralRe: Here's why 0-based indices are beautiful: Pin
Daniel Grunwald10-Mar-11 20:24
Daniel Grunwald10-Mar-11 20:24 
GeneralI can't Understand? Pin
Pritesh Aryan7-Mar-11 17:57
Pritesh Aryan7-Mar-11 17:57 
GeneralRe: I can't Understand? PinPopular
OriginalGriff7-Mar-11 21:35
mveOriginalGriff7-Mar-11 21:35 
Because in the early days there was no concept of an array, just a memory pointer.
So, to have a list of numbers, you set a pointer to the first one, and then added the length of the number in bytes to the pointer to get to the next.
When arrays where developed, the code was simple:
array[index] = 6
became
Set pointer to array start;
set accumulator to index;
multiply accumulator by array element length;
add accumulator to pointer;
Set contents of pointer to 6;
So, arrays started at zero.

It does make sense, numbering starts at zero in nature: I have no oranges, I have one orange, I have two oranges...
Remember all the fun the Romans had, because they didn't have a zero? Laugh | :laugh:
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.

Manfred R. Bihy: "Looks as if OP is learning resistant."

GeneralPeople accepted the reality... Pin
Jun Du7-Mar-11 15:09
Jun Du7-Mar-11 15:09 
GeneralRe: People accepted the reality... Pin
Chaveca_8-Mar-11 23:00
Chaveca_8-Mar-11 23:00 
GeneralRe: People accepted the reality... Pin
Lex Steers10-Mar-11 6:48
Lex Steers10-Mar-11 6:48 
GeneralI don't give a rats Pin
Mycroft Holmes7-Mar-11 14:01
professionalMycroft Holmes7-Mar-11 14:01 
GeneralBoth? Pin
PJ Arends7-Mar-11 6:46
professionalPJ Arends7-Mar-11 6:46 
GeneralRe: Both? Pin
Nagy Vilmos7-Mar-11 7:10
professionalNagy Vilmos7-Mar-11 7:10 
GeneralRe: Both? Pin
PJ Arends7-Mar-11 7:19
professionalPJ Arends7-Mar-11 7:19 
GeneralRe: Both? Pin
#realJSOP8-Mar-11 10:11
professional#realJSOP8-Mar-11 10:11 
GeneralRe: Both? Pin
rittjc8-Mar-11 14:29
rittjc8-Mar-11 14:29 
GeneralMust be 0 in order to be consistent across "all" .NET languages. Pin
The Storm7-Mar-11 6:15
The Storm7-Mar-11 6:15 
GeneralRe: Must be 0 in order to be consistent across "all" .NET languages. Pin
Mike Hankey7-Mar-11 12:08
mveMike Hankey7-Mar-11 12:08 
GeneralRe: Must be 0 in order to be consistent across "all" .NET languages. Pin
rittjc8-Mar-11 14:46
rittjc8-Mar-11 14:46 
GeneralArray/Pointer/Loop/Lifts Pin
Ajay Vijayvargiya7-Mar-11 4:35
Ajay Vijayvargiya7-Mar-11 4:35 
GeneralRe: Array/Pointer/Loop/Lifts Pin
Phil J Pearson7-Mar-11 5:33
Phil J Pearson7-Mar-11 5:33 
GeneralRe: Array/Pointer/Loop/Lifts Pin
Ajay Vijayvargiya7-Mar-11 6:54
Ajay Vijayvargiya7-Mar-11 6:54 
GeneralRe: Array/Pointer/Loop/Lifts Pin
Fabio Franco8-Mar-11 3:22
professionalFabio Franco8-Mar-11 3:22 
GeneralWhy not start at any positive integer? Pin
BillW337-Mar-11 4:32
professionalBillW337-Mar-11 4:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.