title: What is the actual definition of an array?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/392397/arrays-whats-the-point">Arrays, What&rsquo;s the point?</a>  </p>
  </blockquote>
  
  <p>I tried to ask this question before in <a href="https://stackoverflow.com/questions/992679/what-is-the-difference-between-an-array-and-a-list-closed">What is the difference between an array and a list?</a> but my question was closed before reaching a conclusive answer (<a href="https://meta.stackexchange.com/questions/25948/why-is-my-question-not-real/">more about that</a>). </p>
  
  <p>I'm trying to understand what is really meant by the word "array" in computer science. I am trying to reach an answer not have a discussion as per the spirit of this website. What I'm asking is language agnostic but you may draw on your knowledge of what arrays are/do in various languages that you've used.</p>
  
  <p><strong>Ways of thinking about this question:</strong> </p>
  
  <ul>
  <li>Imagine you're designing a new programming language and you decide to implement arrays in it; what does that mean they do? What will the properties and capabilities of those things be. If it depends on the type of language, how so?</li>
  <li>What makes an array an array?</li>
  <li>When is an array not an array? When it is, for example, a list, vector, table, map, or collection?</li>
  </ul>
  
  <p>It's possible there isn't one precise definition of what an array is, if that is the case then are there any standard or near-standard assumptions or what an array is? Are there any common areas at least? Maybe there are several definitions, if that is the case I'm looking for the most precision in each of them.</p>
  
  <p><strong>Language examples:</strong></p>
  
  <p>(Correct me if I'm wrong on any of these).</p>
  
  <ul>
  <li>C arrays are contiguous blocks of memory of a single type that can be traversed using pointer arithmetic or accessed at a specific offset point. They have a fixed size.</li>
  <li>Arrays in JavaScript, Ruby, and PHP, have a variable size and can store an object/scalar of any type they can also grow or have elements removed from them.</li>
  <li>PHP arrays come in two types: numeric and associative. Associative arrays have elements that are stored and retrieved with string keys. Numeric arrays have elements that are stored and retrieved with integers. Interestingly if you have: <code>$eg = array('a', 'b', 'c')</code> and you <code>unset($eg[1])</code> you still retrieve <code>'c'</code> with <code>$eg[2]</code>, only now <code>$eg[1]</code> is undefined. (You can call <code>array_values()</code> to re-index the array). You can also mix string and integer keys.</li>
  </ul>
  
  <p>At this stage of sort of suspecting that C arrays are the only true array here and that strictly-speaking for an array to be an array it has to have all the characteristics I mention in that first bullet point. If that's the case then — again these are suspicions that I'm looking to have confirmed or rejected — arrays in JS and Ruby are actually vectors, and PHP arrays are probably tables of some kind.</p>
  
  <p>Final note: I've made this community wiki so if answers need to be edited a few times in lieu of comments, go ahead and do that. Consensus is in order here.</p>