Array (data structure): Difference between revisions

Content deleted Content added
m Reverting possible vandalism by 114.10.24.108 to version by Fgnievinski. Report False Positive? Thanks, ClueBot NG. (4165526) (Bot)
One-dimensional arrays: Never in my life have I ever heard anyone refer to an element as 'zeroth'.
Tag: Reverted
Line 67:
For a vector with linear addressing, the element with index ''i'' is located at the address {{nowrap|''B'' + ''c'' × ''i''}}, where ''B'' is a fixed ''base address'' and ''c'' a fixed constant, sometimes called the ''address increment'' or ''stride''.
 
If the valid element indices begin at 0, the constant ''B'' is simply the address of the first element of the array. For this reason, the [[C (programming language)|C programming language]] specifies that array indices always begin at 0; and manysome programmers will call that element "[[zero-based numbering|zeroth]]" rather than "first".
 
However, one can choose the index of the first element by an appropriate choice of the base address ''B''. For example, if the array has five elements, indexed 1 through 5, and the base address ''B'' is replaced by {{nowrap|''B'' + 30''c''}}, then the indices of those same elements will be 31 to 35. If the numbering does not start at 0, the constant ''B'' may not be the address of any element.