Maximum subarray sum doubt

sir code compile successfully but while submitting no test cases passes
where i am going wrong

int curr=0;
int maxTillnow=0;

you have to initialize this inside for loop
because this should be done for each testcase

Modified Code

now it pass all testcases