int arr[10] = {};
实际上数组里的内容已经是这样子:0000000000
总结:数组如果像这样使用初始化列表初始化将为你提供默认值,否则未初始化的将是乱值。
int main()
{
int table[][2] = { {1} , {} };
for (int i = 0; i < 2; i++)
{
for (int j = 0; j < 2; j++)
{
cout << table[i][j] << endl;
}
}
getchar();
return 0;
}
程序输出结果:
1 0
0 0