これは私のコード
#include <iostream>
#include <windows.h>
using namespace std;
int main()
{
int x,y, size;
int array[][2] = {{1,2}, {5,6}, {13, 16}, {17, 69}, {100, 200}};
for(x=0; x<5; x++){
for(y=0; y<2; y++){
cout<<array[x][y];
}
cout<<" ";
}
system("pause>nul");
return 0;
}
コードは正常に動作します。しかし、行番号 7 を に置き換えるint array[][2]
とint array[][1]
、次のようなエラー メッセージが表示されます。
64 E:\path\array_multi2.cpp:8 too many initializers for 'int [1]'
何の問題?