I have to return to the previous level of the recursion. is the syntax like below right?
void f()
{
// some code here
//
return;
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, you can return from a void function.
Interestingly, you can also return void from a void function. For example:
As expected, this is the same as a plain
return;. It may seem esoteric, but the reason is for template consistency:Here,
default_valuereturns a default-constructed object of type T, and because of the ability to returnvoid, it works even whenT=void.