0
我想學C++,當我來到陣列試圖運行這段代碼,當它來到了這一點:未處理表達陣列C++
Unhandled exception at 0x00c3151f in array.exe: 0xC0000005: Access violation writing location 0x00390018
這是我的代碼:
#include <iostream>
using namespace std;
int main()
{
int x;
int y;
int array[8][8]; //Declares an array like a chessboard
for (x = 0; x < 8; x++) {
for (y = 0; y < 8; x++)
array[x][y] = x * y; // Set each element to a value
}
cout<<"Array Indices:\n";
for (x = 0; x < 8; x++) {
for (y = 0; y < 8; x++)
cout<<"["<<x<<"]["<<y<<"]="<< array[x][y] <<" ";
cout<<"\n";
}
cin.get();
}
提問前請使用調試器。 – chris 2014-09-21 21:03:51