I presume you are referring to variable-length-array parameters of C99.
I think your textbook is trying to say that you can use as a length specifier not only other arguments of a function, e.g.:
void f(int array_len, char array[array_len]);
but something outside but still visible, like global variable:
int some_value;
void f(char array[some_vaue]);
Keep in mind - this does not necessarily mean compiler will do array bounds checks for you. This is useful when you use multidimensional arrays to navigate on inner dimensions.
So instead of this code:
int *arr = malloc(sizeof(int)*NROWS*NCOLS);
void f(int *a)
{
int row, int column;
...calculate row, column
int value = a[row*NCOLS+column];
...
}
you will write:
int arr[NROWS][NCOLS];
int get_array_cols()
{
return NCOLS;
}
int array_rows=NROWS;//or calculate...
void f(int a[array_rows][get_array_cols()])
{
int row, int column;
...calculate row, column
int value=a[row][column];
...
}
as you can see anything couldbe there.
Basically, when compiler knows how to get value for dimensions, it can automatically prepare this expression: a[row*NCOLS+column];
(row*NCOLS). For example in my last case, having dimensions hint, it will automatically compile a[row][col]
into: a[row*get_array_cols()+col]
.