Arrays

Array declarations are of the form:

[attributes] type name[size];

Each element (of type type) within the array is accessed using name[index], where index is in the range 0 to size - 1 inclusive.

Multi-dimensional arrays may be declared:

[attributes] type name[sizeA][sizeB][sizeC];

Each element within the array is accessed using name[indexA][indexB][indexC].

Initial values may be specified:

[attributes] type name[size] = {constant, constant, constant};
[attributes] char name[size] = "string";

Initialised arrays may have their size determined by the number of values listed:

[attributes] type name[] = {constant, constant, constant};
[attributes] char name[] = "string";

name refers to the base address of an entire array (i.e. this is exactly equivalent to &name[0]). Note that this means only the base address of any array can be passed to a function, the value of the array itself cannot be passed.

Arrays and structures may be nested to several levels.