What's causing this?
The program crashes right before it closes. I have no idea what is wrong.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
#include <iostream>
using namespace std;
int main()
{
int Array[4][13];
int j, k, i;
for(i = 0;i < 13;i++)
{
Array[1][i] = i + 1;
Array[2][i] = i + 1;
Array[3][i] = i + 1;
Array[4][i] = i + 1;
}
cin >> j >> k;
cout << Array[j][k] << endl;
return 0;
}
|
It is because Array[4][i]
is invalid.
Thank you very much
No problem. It is always the simple stuff that is missed. (It took me a puzzling few minutes to realize what was wrong too...)
Topic archived. No new replies allowed.