Click here to Skip to main content
15,899,126 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: It should be a choiche, in high level programming languages Pin
Johnny J.6-Mar-11 21:46
professionalJohnny J.6-Mar-11 21:46 
GeneralRe: It should be a choiche, in high level programming languages Pin
Emilio Garavaglia7-Mar-11 4:03
Emilio Garavaglia7-Mar-11 4:03 
GeneralRe: It should be a choiche, in high level programming languages Pin
Rob Grainger7-Mar-11 22:10
Rob Grainger7-Mar-11 22:10 
GeneralRe: It should be a choiche, in high level programming languages Pin
Emilio Garavaglia8-Mar-11 4:33
Emilio Garavaglia8-Mar-11 4:33 
GeneralRe: It should be a choiche, in high level programming languages Pin
Klaus-Werner Konrad13-Mar-11 2:41
Klaus-Werner Konrad13-Mar-11 2:41 
GeneralRe: It should be a choiche, in high level programming languages Pin
Emilio Garavaglia13-Mar-11 8:14
Emilio Garavaglia13-Mar-11 8:14 
GeneralRe: It should be a choiche, in high level programming languages Pin
Klaus-Werner Konrad13-Mar-11 10:04
Klaus-Werner Konrad13-Mar-11 10:04 
GeneralRe: It should be a choiche, in high level programming languages Pin
Emilio Garavaglia13-Mar-11 21:05
Emilio Garavaglia13-Mar-11 21:05 
Klaus-Werner Konrad wrote:
Generally an array index is not more than the OFFSET from the start of the
array, and the count is the length


Wrong.
A C array index is not more than the OFFSET from the start of the
array, and the count is the length. (C array, not generally).

But the question was another. "Should in high level programming language ..."
So, first, before teaching me the C language read carefolly the question (including the puctuation), than define:

1) What is an "high level language"? Is it ASM? C? C++? D? LISP? English? TNPL(aka "the new programming language": I just inventing it right now?)
2) What is an "array"? a "bouch of continguos memory holding identical objects"? a "set of identical object identifyed by an index"? a "set of similar objects identifyed by a key"?
3) What is the behavior of elements and indexes respect to insertion removal? Shold the indexes remain contiguous? Shuold them remain stable?

If you think to a well specific language (like C) every of the above question has an exact precise ansewr.
If you are designing something on a higer abstraction level ... all of those answers can be true. Of course, you'll come to different implementations. Sometimes even not based on C arrays.

Just as am example, give a look on how the "D laguage" defines arrays[^].
Yes, in their simple declination they start at 0, but can have even whatever kind of key!

2 bugs found.
> recompile ...
65534 bugs found.
D'Oh! | :doh:


GeneralRe: It should be a choiche, in high level programming languages Pin
Klaus-Werner Konrad14-Mar-11 11:15
Klaus-Werner Konrad14-Mar-11 11:15 
General...except when... Pin
OriginalGriff6-Mar-11 20:59
mveOriginalGriff6-Mar-11 20:59 
GeneralRe: ...except when... Pin
Johnny J.6-Mar-11 21:40
professionalJohnny J.6-Mar-11 21:40 
GeneralRe: ...except when... Pin
OriginalGriff6-Mar-11 21:42
mveOriginalGriff6-Mar-11 21:42 
GeneralRe: ...except when... Pin
Nagy Vilmos7-Mar-11 6:55
professionalNagy Vilmos7-Mar-11 6:55 
GeneralRe: ...except when... Pin
OriginalGriff7-Mar-11 8:27
mveOriginalGriff7-Mar-11 8:27 
GeneralIt should start from 0 in a high-level programming language. PinPopular
OriginalGriff6-Mar-11 20:58
mveOriginalGriff6-Mar-11 20:58 
GeneralRe: It should start from 0 in a high-level programming language. Pin
Johnny J.6-Mar-11 21:39
professionalJohnny J.6-Mar-11 21:39 
GeneralRe: It should start from 0 in a high-level programming language. Pin
OriginalGriff6-Mar-11 22:04
mveOriginalGriff6-Mar-11 22:04 
GeneralMessage Removed Pin
7-Mar-11 4:34
professionalN_tro_P7-Mar-11 4:34 
GeneralRe: It should start from 0 in a high-level programming language. [modified] Pin
Indivara6-Mar-11 22:07
professionalIndivara6-Mar-11 22:07 
GeneralRe: It should start from 0 in a high-level programming language. Pin
hairy_hats7-Mar-11 0:21
hairy_hats7-Mar-11 0:21 
GeneralRe: It should start from 0 in a high-level programming language. Pin
Indivara7-Mar-11 3:46
professionalIndivara7-Mar-11 3:46 
GeneralRe: It should start from 0 in a high-level programming language. Pin
Pritesh Aryan7-Mar-11 18:09
Pritesh Aryan7-Mar-11 18:09 
GeneralRe: It should start from 0 in a high-level programming language. Pin
Indivara8-Mar-11 3:05
professionalIndivara8-Mar-11 3:05 
GeneralRe: It should start from 0 in a high-level programming language. Pin
Bassam Abdul-Baki7-Mar-11 1:13
professionalBassam Abdul-Baki7-Mar-11 1:13 
GeneralMessage Removed Pin
7-Mar-11 4:36
professionalN_tro_P7-Mar-11 4:36 

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.