揮発性のメモ2

http://d.hatena.ne.jp/iww/

配列の初期化時に後ろがゼロで埋められるのは仕様

C99だと仕様。それより前は知らん。

6.7.8 Initialization
・・・
10 If an object that has automatic storage duration is not initialized explicitly, its value is indeterminate. If an object that has static storage duration is not initialized explicitly, then:
— if it has pointer type, it is initialized to a null pointer;
— if it has arithmetic type, it is initialized to (positive or unsigned) zero;
・・・
21 If there are fewer initializers in a brace-enclosed list than there are elements or members of an aggregate, or fewer characters in a string literal used to initialize an array of known size than there are elements in the array, the remainder of the aggregate shall be initialized implicitly the same as objects that have static storage duration.
・・・