Can anybody please help to find an error in this code? I am not able to get the error, & its giving a Runtime error. I checked all loops used for matrix but not able to find an error.
int n, arr[n][n];
cin>>n;
for (i=0; i<n; i++)
{
for(j=0; j<n; j++)
{
cin>>arr[i][j];
}
}
for (i=0; i<n; i++)
{
for(j=0; j<n; j++)
{
sum = 0;
prev = ne;
ne = 0;
if(arr[i][j] == 1)
{
ne = i+j;
prev = i+j;
sum = ne - prev;
if(sum<0)
sum=-sum;
steps+=sum;
}
c++;
}
}