hello I'm trying to solve an exercise about the sequence of numbers in a list with the greatest sum: I need to write a (non-recursive) function that returns the largest sum of numbers in the list. example: in the list:[-1,4,-10,9,14,-4] need to return 23 because 9+14=23 and its the maximum sum in this list. i'm beeginer in C and don't know how using deboguer with list in C? can you help me to undersand where are my problems?
int sum_lst(int lst[],int debut,int fin){
int i=debut,sum=0;
for (i;i<fin;i++){
sum+=lst[i];
}
return sum;
}
int max_sum(int lst[],int n){
int i=n;
static int sum;
int j=0;
for (i;i>0;i--){
for (j;j<n;j++){
if (sum_lst(lst,j,i)>sum){
sum= sum_lst(lst,i,j);
}
}
}
return sum;
}