If I run this code:
#include<bits/stdc++.h>
using namespace std;
int hourGlass(int x, int y) {
int sum;
for (int a=y; a<=y+2; a++) {
sum += arr[x][a];
sum += arr[x+2][a];
}
return sum;
}
int main(){
int arr[7][7];
for (int i=0; i<=5; i++) {
for (int j=0; j<=5; j++) {
cin >> arr[i][j];
}
}
for (int i=0; i<=3; i++) {
for (int j=0; j<=3; j++) {
cout << hourGlass(i,j);
}
}
}
It gives the error 'arr' was not declare on this scope
. How do I fix this?