Open main menu

Wikibooks β

Changes

C Programming/Arrays

383 bytes added, 14 years ago
m
no edit summary
==Arrays Key ==
[[Concepts in Programming|Concepts]]
[[Variables in Programming|Variables]]
[[Variable Types in Programming|Types]]
[[Variable Arrays in Programming|Arrays]]
[[C in Programming|C]] Concepts
[[Variables in C in Programming|Variables]]
[[Variable Types in C in Programming|Types]]
[[Variable Arrays in C in Programming|Arrays]]
== Arrays ==
Arrays could be considered an extension of an existing variable's type: arrays cannot exist as a type on their own but act just to extend an existing variable. An array applied to a variable implies not a single variable but a series of variables of a single type indexed by integers starting from zero. The characters used to indicate an array are '[<var>x</var>]' where '<var>x</var>' is the number of variables in the series. For example, a single integer variable would be defined by <tt>int</tt>, but an array (series) of seven integer variables could be defined by <tt>int[7]</tt>. Assuming this variable had the name <var>a</var>, the individual integer variables could be accessed as <tt>a[0]</tt>, <tt>a[1]</tt>, <tt>a[2]</tt> and so on until <tt>a[6]</tt>. The integer used to index the series of variables is also known as a ''subscript''.
74
edits