This function return the sum of the numbers that are bigger than k. I understand all of its logic but iam confused with return 0. Say we have k = 9, so we adding numbers until tam ==0, but by returning 0 shouldn't we lose the value that we accumulated? How come the function return the sum and zero at same time?
Code:#include <stdio.h> int SumBiggerThanK(int k, int a[], int size) { if(tam==0) { printf("GOT HERE"); return 0; } else if(a[size-1]>=k) { return a[size-1] + SSIK(k, a, size-1); } else { return SSIK(k, a, size-1); } } int main() { int a[]={9, 18, 31, 40, 42}; printf("%d\n", SumBiggerThanK(9,a, 5)); }