次のコードを見てください。
int arr[4];
for (int index = 0; index < 4; ++index) {
printf("%d\t", arr[index]);
}
次のようにランダムな値を出力します。
27224 -6784 32766 0
しかし、に設定arr
すると{}
、代わりにゼロが出力されます。
int arr[4] = {};
for (int index = 0; index < 4; ++index) {
printf("%d\t", arr[index]);
}
0 0 0 0
どうして?
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加