c/language/initialization

A of an object may provide its initial value through the process known as initialization.

For each, the initializer, if not omitted, may be one of the following:

where is a non-empty comma-separated list of s (with an optional trailing comma), where each initializer has one of three possible forms:

Explanation
The initializer specifies the initial value stored in an object.

Explicit initialization
If an initializer is provided, see
 * for the initialization of scalar types
 * for the initialization of array types
 * for the initialization of struct and union types.

Implicit initialization
If an initializer is not provided:
 * objects with automatic are initialized to indeterminate values (which may be )
 * objects with static and thread-local are empty-initialized

Empty initialization
In some cases, an object is empty-initialized if it is not initialized explicitly, that is:
 * pointers are initialized to null pointer values of their types
 * objects of integral types are initialized to unsigned zero
 * objects of floating types are initialized to positive zero
 * all elements of arrays, all members of structs, and the first members of unions are empty-initialized, recursively, plus all padding bits are initialized to zero
 * (on platforms where null pointer values and floating zeroes have all-bit-zero representations, this form of initialization for statics is normally implemented by allocating them in the .bss section of the program image)