Basically, recursive function call is the same as any other function call. The function parameters are put onto stack, and then the function is executed in the same way it is done for the call from main (local variables are allocated on stack and they have no connection to the ones that were allocated on the first call, etc.). When this recursive call returns, the control goes to the point where this recursive call was made.
When you write
return palindrome_2(vec,begin+1,end-1);
it essentially means "The result that should be returned to the caller, is equal to the result returned by palindrome_2 with the following parameters: vec, begin+1, end-1". If it makes it more clear, the following code does pretty much the same thing in a more verbose way:
1 2
|
bool result = palindrome_2(vec,begin+1,end-1);
return result;
|
For the base2 function - you declare that it doesn't return any value - the representation of the number in binary form is accumulated in the parameter str that is passed by reference (which basically means that the vector passed into this function is modified directly, but this is a slightly different topic, not specific to recursion).
So as long as you understand how normal functions work (how parameters, local variables and return values are handled) you should be able to understand how the recursive calls operate: they are exactly the same as normal function calls.
Hope this clears up things a bit. If not - just ask about the things that confuse you.