Sum of array elements using recursion(C language)

preview_player
Показать описание
finding the sum of the elements of the array using recursion.
Рекомендации по теме
Комментарии
Автор

can you help me please i have this code to check if the elements in array are monotone.
int is_monotone_rec(int *a, int n)
{
if(n==1)
return 1;
if(a[0]>a[1])
return 0;
return is_monotone_rec(a+1, n-1);
}

my question is, how the recursion cuts the array? in your example when you make n-1, your array is getting smaller from the end, and in my example i think the array is getting smaller from the begginning can you explain it please

benny