Max subarray code run time error

i have tried this problem using kadane’s algorithm but it is giving wrong answer due to some error. please tell me where i am going wrong ?

There were a few implementation errors throughout the code.
Please see your corrected code https://ide.codingblocks.com/s/238630