It is showing run error while i am submitting code;

#include
#include
using namespace std;
int sumis(int a[],int n){
int current_max =0;
int max_so_far=0;
for(int i=0;i<n;i++){
current_max=current_max + a[i];
current_max= max(current_max,0);
max_so_far =max(current_max,max_so_far);
}
return max_so_far;
}
int main() {
int N;
cin>>N;
for(int i=N;i>0;i–){
int n;
int a[1000];
cin>>n;
for(int i=0;i<n;i++){
cin>>a[i];
}
cout<<sumis(a,n);
cout<<endl;
}

return 0;

}

Hey @bhanu it would be great if you can share your code using ide.codingblocks.com

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.

your logic was correct but the array declaration was wrong I have corrected it please check the corrected code:

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.