Hello
I have just learnt recursion & I thought I would try & alter some of my previous funtions to make them recursive, well the 1st function I try to alter totally stumps me & I thought I understood recursion :P
Is it possible to make this function recursive?
int findSum (vector < int > v)
{
int sum = 0
for (int i=0; i<v.size(); i++) {
sum += v.at(i);
}
return sum;
}
I am trying to get the function to find and return the sum of all elements in a vector