Initialization provides an initial value for a C object. An initializer augments a declaration; when a declaration includes one, it also defines the object and requires storage for its value. section 2.3
Designated array initialization
A designated initializer assigns values to selected array positions: A[0] becomes 9.0, A[1] becomes 2.9, A[3] becomes .00007, and A[4] becomes 3.E+25. The omitted position A[2] is initialized to 0.0. Array indices begin at 0, so an array of n elements ends at index n-1. section 2.3
Choose initialization according to the object's storage duration and allocation method:
- Rely on default initialization for objects with static or thread storage duration: arithmetic members become 0 and pointer members become nullptr. section 13.4
- Initialize automatic and allocated objects explicitly so they enter a well-defined state before use. section 13.4
- Use calloc for dynamically allocated objects when an all-bits-zero representation is valid; otherwise initialize through assignment or a dedicated function. section 13.4
- Provide a consistent initialization function for each data type, including constructors such as rat_init, rat_new, rat_vinit, and rat_vnew. section 13.4
double A[5] = {
[0] = 9.0,
[1] = 2.9,
[4] = 3.E+25,
[3] = .00007,
};
Inspect the complete designated initializer and its ordering of array elements. section 2.3




