Recursion in C++ Language
Recursion refers to a situation where the same function is called within the function itself. The function which calls the same function is known as recursive function.
A function that calls itself, and does not perform any tasks after the function call, is known as tail recursion. In tail recursion, we usually call the same function with a return statement.
Let's look at a simple example of recursion -
C++ Recursion Example -
Let's look at an example to print the factorial of a number using recursion in C++ language.
Output -
Enter any number : 6
Factorial of a number is : 720