What actually happens when you declare an array with empty bounds of type int
for example? How does your computer manage the memory allocated to that specific empty array?
int A[];
What actually happens when you declare an array with empty bounds of type int
for example? How does your computer manage the memory allocated to that specific empty array?
int A[];
Inside a function body, int A[];
is a constraint violation.
Outside of a function, a variable definition with no initializer is called a tentative definition. This one defines that A
is an array of int
of unknown bound. The type of A
is an incomplete type because the bound is not known yet. It may be completed later:
int A[];
void f()
{
A[0] = 1;
}
int A[5];
If the latter definition is omitted, the program behaves as if the source file had int A[1];
at the end.