A Function Call itself is known as Recursive Function. And, this technique is known as recursion in c++.
If there is no base case in the recursive function, the recursive function will continue to repeat continuously.
The syntax to declare a Recursive Function in c++ is :
void recursionfunction() { ... .. ... recursionfunction(); // Recursive Call ... .. ... }
Example of Factorial of a Number Using Recursion :
#include<iostream> using namespace std; int main() {  int factorial(int);  int fact,value;  cout<<"Enter any number: ";  cin>>value;  fact=factorial(value); // Function Call  cout<<"Factorial of a number is: "<<fact<<endl;  return 0; } int factorial(int n) {  if(n==0)  {    return(1);  /*Terminating condition*/  }  else  {    return(n*factorial(n-1));  } }
output
Enter any number: 5 Factorial of a number is: 120
Also read this :- Function in C++
Advantages of C++ Recursion :
It makes our code shorter and cleaner.
Recursion is required in problems concerning data structures and advanced algorithms, such as Graph and Tree Traversal.
Disadvantages of C++ Recursion :
It takes a lot of stack space compared to an iterative program.
It uses more processor time.
It can be more difficult to debug compared to an equivalent iterative program.
I like your blog because i easily understand your blog content. it is a very useful content. i hope you will upload more useful content in programming world.