Zero-based numbering

From Wiki @ Karl Jones dot com
Jump to: navigation, search

In computer programming, zero-based numbering is a way of numbering in which the initial element of a sequence is assigned the index 0, rather than the index 1 as is typical in everyday non-programming circumstances. See Array data structure.

Description

Under zero-based numbering, the initial element is sometimes termed the zeroth element, rather than the first element; zeroth is a coined ordinal number corresponding to the number zero.

In some cases, an object or value that does not (originally) belong to a given sequence, but which could be naturally placed before its initial element, may be termed the zeroth element.

There is not wide agreement regarding the correctness of using zero as an ordinal (nor regarding use of the term zeroth) as it creates ambiguity for all subsequent elements of the sequence when lacking context.

Numbering sequences starting at 0 is quite common in mathematics, in particular in combinatorics.

In computer science, array indices also often start at 0, so computer programmers might use zeroth in situations where others might use first, and so forth.

See also

External links