Questions tagged [array]

An array is a systematic arrangement of similar objects, usually in rows and columns.

222 questions
112
votes
39 answers

Why are zero-based arrays the norm?

A question asked here reminded me of a discussion I had with a fellow programmer. He argued that zero-based arrays should be replaced with one-based arrays since arrays being zero-based is an implementation detail that originates from the way arrays…
1
vote
3 answers

memory management of multi-dimensional array

Could you please show me an example how to compute the location of an element in a multi-dimensional array. It is illustrated in Robert Sebesta's book Concept of Programming Languages that location of an element is given by the…
justin
  • 237
-1
votes
1 answer

Creating block of data from a large input data

I am working on an algorithm whose specs says that it accepts 32 bit input (long type). My actual data is 14 bytes e.g 11:12:12:04:DD I have created sub arrays like subarray1[4]={'1','1',':',1} // 32 bits Can I pass this subarray to my…
-4
votes
1 answer

A good metaphor for "lists" (arrays)?

When teaching students Python lists (which are more like arrays, not linked-lists) I'd like to use metaphor of list being a collection of boxes put in row. But this doesn't work well: indexes are important to be numbers, but in my example indexes…
danbst
  • 93