3 ms·
Because that's not how array initialisation works in C. The specified indices are initialised with the provided values, and the missing elements are always init
by hyper_reality 9y ago
Because that's not how array initialisation works in C. The specified indices are initialised with the provided values, and the missing elements are always initialised to 0. See for instance section 6.7.9 of the C99 standard. Perhaps you were confused by the common idiom:
> int array[5] = { 0 };
which takes advantage of this missing element initialization behaviour.