hello.at(p-1)
at first p is 2
then you call sumSquares(hello.at(2-1))
which is equal to sumSquares(hello.at(1))
and therefore equal to sumSquares(2)
so p is 2 again and you have infinite recursion.
I think you want to call this instead: sumSquares(p-1);
I was gonna reply with "no, you are wrong" but then I kept re-reading your post. It took me 15 min to get it
Holy f***. You are right.
Thank you SO MUCH. I would have never spotted that. I kept printing values of p at the first call and everything seemed fine in every way but yes, there is a major logic flaws there.
I basically call sumSquares with a SIZE and then call it again with CONTENT which makes no sense whatsoever. Thanks.
..and now I am stuck because I have to generate as many vectors as input by the user. Basically I need two layers of recursion which is crazy
Which probably means that you have a bad design.
look at my example above, I hope it helps you to solve that task :)
And I think you're playing around with recursion because you want to learn it but I think this example would be better not implemented using recursion but a loop.