I think my code is correct but getting segmentation fault.Can you please tell me my mistake in comments in program

question: maximum subarray sum

answer link:

www.codeshare.io/G83d3A