Question: I want to write a function in C `void cumsum(int *array, int length)` that receives an array as an input then changes its element of that array to the cumulative sum using RECURSION. For instance if i have `array = {1,2,3}` the output should be `array={1,3,6}`.

So, how I can do this using recursion.

Answer: 
```
void cumsum(int *array, int index) {
    if(index <= 0) return;
    cumsum(array, index -1);
    array[index] += array[index - 1];
}

int main(void) {
    int array[] = {1,2,3};
    cumsum(array, 2}; //you had to call with the index of the last element (size-1)
    printf("%d %d %d\n", array[0], array[1], array[2]);
    return 0;
}

```
one way:

```
void cumsum(int* array, int length,int pos){
if(pos+1<length) array=cumsum(array,length,pos+1);
 for(int i=pos+1;i<length;i++){
  array[i]+=array[pos];
 }
}    

```