I’ll use the latest draft N2176 (that I found here: http://www.iso-9899.info/wiki/The_Standard) of C standardization to respond.
In the section [6.7.6], one of the parts of the syntax of a declarator is the direct statement (or direct-declarator), which is where the syntax for the arrangement statement is. What interests us here is the array (array declarator): given a statement T D1
, if D1
is in one of the following forms:
D [ type-Qualifier-listopt assignment-Expressionopt ]
D [ type-Qualifier-listopt assignment-Expression ]
D [ type-Qualifier-list Static assignment-Expression ]
D [ type-Qualifier-listopt ]
So we have an array declarator. Note that the brackets are only used to indicate an array declarator, nothing else. There is no underwritten operation1 occurring here. For example, in the int a[8]
, the part a[8]
is an arrangement declarator, where 8
is the size of the arrangement (or amount of elements).
If we are not in the context of statement and find an expression in the form I[N]
, where I
has already been declared an arrangement (or pointer) so we certainly have the underwriting operation taking place. For example:
int a[8]; // Declara `a` como um arranjo de 8 elementos de tipo `int`.
a[0]; // Acessa o primeiro elemento de `a`, retornando um valor do tipo `int`.
Finally, on his last question regarding the equivalence between arrangements and pointers: arrangements can decay to pointers. Elaborating: in the declaration int a[8]
, the identifier a
was declared to have the type int[8]
. However, the expression a
may well result in a value whose type is a pointer.
void foo(int *);
int main()
{
int a[8]; // Declara `a` tendo tipo `int[8]`.
foo(a); // O valor que a expressão `a` em si gera terá o
// tipo decaído para um `int *`.
}
This decay behavior is described in the section [6.3.2/3]:
Except when it is the operand of the sizeof Operator, or the unary &
Operator, or is a string literal used to initialize an array, an Expression that has type "array of type" is converted to an Expression with type "Pointer to type" that points to the initial element of the Object array and is not an lvalue. [...]
1 Subscribed is the name of the transaction access to elements of an arrangement.