An array contains both positive and negative elements, find the maximum subarray whose sum equals 0.
Hope this will help.
int v[DIM] = {2, -3, 1, 2, 3, 1, 4, -6, 7, -5, -1}; int i,j,sum=0,counter=0; for (i=0; i