What kind of error is this?

I was solving this question Grid Game - Prefix Sum Problem | CodeChef and when I tried to run my program I was getting this error
prog.cpp: In function ‘int main()’:
prog.cpp:30:26: error: invalid types ‘long long int[long long int]’ for array subscript
sum+=a[i][j];

here is my Program
‘’’
#include
using namespace std;

int main() {
// your code goes here
int t;
cin>>t;
while(t–){
long long n,m;
cin>>n>>m;
long long a[n][m];
for(long long i=0;i<n;i++){
for(long long j=0;j<m;j++){
cin>>a[i][j];
}
}
long long query;
cin>>query;

    while(query--){
        long long a,b,x,y;
        cin>>a>>b>>x>>y;
        a--;
        b--;
        x--;
        y--;
        for(long long i=a;i<=x;i++){
            long long sum=0;
            for(long long j=b;j<=y;j++){
                sum+=a[i][j];
            }
            cout<<sum<<endl;
        }
    }
    
}
return 0;

}
‘’’
can someone please tell me what am I doing wrong and what this error means?
(I tried to formate my code but it’s not working ProPerly)

Take n, m, i and j as int or size_t.
Indexes can’t be of type long long
Also, you can’t use long long (here, n and m) to declare array

I did what you said but it’s still not working?
what should I do?

The error is that you have used name of one variable and array both as “a”
Replace name of array as arr or sth…

1 Like

thank you sooooooooooooooooo much :+1: :star_struck: