Chapter 8
Chapter 8
If a built-in array’s size is omitted from a declaration with an initializer list, the compiler
sizes the built-in array to the number of elements in the initializer list.
For example,
int n[] = { 50, 20, 30, 10, 40 };
creates a five-element array.
Passing Built-In Arrays to Functions
The value of a built-in array’s name is implicitly convertible to
the address of the built-in array’s first element.
◦ So arrayName is implicitly convertible to &arrayName[0].
You don’t need to take the address (&) of a built-in array to
pass it to a function—you simply pass the built-in array’s
name.
For built-in arrays, the called function can modify all the
elements of a built-in array in the caller—unless the function
precedes the corresponding built-in array parameter with
const to indicate that the elements should not be modified.