My code is 100% correct but getting segmentation fault

question link:
www.practice.geeksforgeeks.org/problems/kadanes-algorithm/0

answer link:

www.codeshare.io/aYkYrM

@aarijrab your code is not correct, it is giving wrong answer even for sample test case then on what basis are you guarantying 100%.

could you correct me where i am getting wrong???

could you tell me where i am getting wrong

@aarijrab please look for the comments in this code https://ide.codingblocks.com/s/321171