This code crashes, unless the indicated line is commented out, then it works beautifully. I cannot understand this because it is the 3rd in a series of 4 repetitions of the same thing. Any help is appreciated. Thanks
int x=0;
int y=0;
int lp=0;
for(lp=1;lp<=4;lp++)
{
y=0;
x++;
y++;
A[x][y]=rand() % 9 + 0;
cout << x << "-" << y<< " A=" <<A[x][y] << " " << "\n";
y++;
A[x][y]=rand() % 9 + 0;
cout << x << "-" << y<< " A=" <<A[x][y] << " " << "\n";
y++;
A[x][y]=rand() % 9 + 0;//comment out this line and it works
cout << x << "-" << y<< " A=" <<A[x][y] << " " << "\n";
y++;
A[x][y]=rand() % 9 + 0;
cout << x << "-" << y<< " A=" <<A[x][y] << " " << "\n";
Expected output
1-1 A=6
1-2 A=6
1-3 A=5
1-4 A=3
2-1 A=3
2-2 A=7
2-3 A=8
2-4 A=0
3-1 A=4
3-2 A=4
3-3 A=8
3-4 A=2
4-1 A=7
4-2 A=2
4-3 A=6
4-4 A=5