the code is having a run time error, why?
#include
#include
using namespace std;
int main() {
int t;
cin>>t;
int n;
int arr[n];
while(t>0){
cin>>n;
int cs=0,ms=0;
for(int i=0; i<n ;i++){
cin>>arr[i];
}
for(int i=0; i<n ; i++){
cs=cs+arr[i];
if(cs<0){
cs=0;
}
ms= max(cs, ms);
}
cout<<ms<<endl;
t–;
}
return 0;
}