Kadane 's algorithm

https://ide.codingblocks.com/#/s/13790
this is the code in video my doubt is that in case i have an array of negative numbers then it gives zero ans while ans in this case should be -1 the test case i have put
@Prateek-Narang-10209 sir

Hy Keshav,
You just need to initialize max_so_far variable with IntMin and rest of the code will work fine