有人可以告诉我这里有什么问题吗?C中的多个暗淡阵列
int arr[15][1];
int main()
{
int x;
for(x=0; x<15; x++)
{
arr[x][0] = x;
arr[x][1] = x;
}
int y;
for(y=0; y<15; y++)
{
printf("[%d][0]=%u\t", y, arr[y][0]);
printf("[%d][1]=%u\n", y, arr[y][1]);
}
}
它给了我下面的输出,我无法弄清楚什么是错的,而输出[0] [0],[0] [1]应该为0,0等休息?
[0][0]=0 [0][1]=1
[1][0]=1 [1][1]=2
[2][0]=2 [2][1]=3
[3][0]=3 [3][1]=4
[4][0]=4 [4][1]=5
[5][0]=5 [5][1]=6
[6][0]=6 [6][1]=7
[7][0]=7 [7][1]=8
[8][0]=8 [8][1]=9
[9][0]=9 [9][1]=10
[10][0]=10 [10][1]=11
[11][0]=11 [11][1]=12
[12][0]=12 [12][1]=13
[13][0]=13 [13][1]=14
[14][0]=14 [14][1]=14
看起来像数组大小应该是'[15] [2]'。 – trutheality 2012-04-16 04:25:10
它应该是'int arr [15] [2]'。 – jweyrich 2012-04-16 04:25:16