getting runtime error while reading 2d arrays
my code:
int ar[3][3];
for(int i=0;i<3;i++)
for(int j=0;j<3;j++)
cin>>ar[i][j];
Please post the entirety of your code (assuming it’s not from an ongoing Contest), formatted: I can’t see any reason why that would crash.
1 Like
#include <iostream>
using namespace std;
int alist[4][10];
int main() {
int i=0,j=0,n;
cin>>n;
for(i=0;i<3;i++)
{
for(j=0;i<n;j++)
{
cin>>alist[i][j];
}
}
cout<<"hello";
return 0;
}
i have included iosteam
Formatted, please 
What input is causing this to crash? What Problem are you solving?
Edit:
This code is significantly different to the code you posted in the OP.
1 Like
This will give out of bounds error when n > 10.
1 Like

