SIR CAN YOU PLEASE TELL WHY THE COMPILER IS SHOWING RUNTIME ERROR IN THE CODING BLOCK COMILER

include <bits/stdc++.h>

using namespace std;

int main () {
int t;
cin >> t;
while(t–)
{
int arr[1000];
int n;
cin >> n;
for (int i = 0; i <n ; i++) {
cin >> arr[i];
}

    int cs=0;
    int ms=INT_MIN;

    for (int i = 0; i <n ; i++) {
        cs=cs+arr[i];
        if (cs<0)
        {
            cs=0;
        }
        ms=max(ms,cs);
    }
    cout <<ms << endl;
}

}

hello @sharmatarun392000

array size is small.
first read array size and then use that size to declare array.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.