Talk:c/language/array initialization

I believe this site lacks the documentation of how array elements are initialized if the initializer list is smaller than the number of elements, like

int x[3] = {1};

There are (correct) examples that the remaining entries are set to zero, but I'd recommend it should be documented in a sentence somewhere, like this:

If the initializer list is smaller than the number of elements in the array, all remaining array entries are set to zero.

217.225.207.234 02:45, 29 November 2019 (PST)
 * the page does say this, near the top, "All array elements that are not initialized explicitly are initialized implicitly the same way as objects that have static storage duration" --Cubbi (talk) 11:06, 29 November 2019 (PST)
 * Absolutely, thanks! 88.217.183.138 23:58, 2 December 2019 (PST)
 * That statement doesn't help here. If I didn't know the rules of the language I would have no idea what the above statement is explicitly initialising. 121.200.5.238 21:13, 10 June 2020 (PDT)

The following example is misleading in context (though correct):

int z[3] = {0}; // z has type int[3] and holds all zeroes

Simply changing it to:

int z[3] = {1}; // z[0] is 1, z[1] and z[2] are 0

Will be both correct and not misleading.

121.200.5.238 21:13, 10 June 2020 (PDT)