[Main]
Title=Array subscript operator ('[...]')
Index=[, ]

[Top]
Brackets indicate single and multidimensional array subscripts. When used
as an operator, the expression
<PRE><I>expr1</I>[<I>expr2</I>]
</PRE>
is defined exactly as
<PRE>*((<I>expr1</I>) + (<I>expr2</I>))
</PRE>
where either <I>expr1</I> is a pointer and <I>expr2</I> is an integer,
or <I>expr1</I> is an integer and <I>expr2</I> is a pointer. Of course,
the addition is performed in according to the pointer arithmetic rules
(see <A HREF="$$LINK(binpm)">binary plus</A> for more info).
<BR><BR>
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.
<BR><BR>
When used as a punctuator, brackets are used for creating array types (see
<A HREF="$$LINK(asterisk)">asterisk</A> for more info).
<BR><BR>
<B>Note:</B> The GNU C extends the usage of square brackets to allow
<A HREF="$$INFOLINK(gnuexts/SEC82)">labeling elements in initializers</A>.
