 |
Array subscript operator ('[...]') |
Brackets indicate single and multidimensional array subscripts. When used
as an operator, the expression
expr1[expr2]
is defined exactly as
*((expr1) + (expr2))
where either expr1 is a pointer and expr2 is an integer,
or expr1 is an integer and expr2 is a pointer. Of course,
the addition is performed in according to the pointer arithmetic rules
(see binary plus for more info).
Note that every array name, if used alone (without the array subscript operator), is
automatically interpreted as a pointer to the first element of the array.
When used as a punctuator, brackets are used for creating array types (see
asterisk for more info).
Note: The GNU C extends the usage of square brackets to allow
labeling elements in initializers.