C recursion function

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

Recursion Concept :

  1. Recursion is basic concept in Programming.
  2. When Function is defined in terms of itself then it is called as “Recursion Function“.
  3. Recursive function is a function which contains a call to itself.


 
int factorial(int n)
{
if(n==0)
return(1);
else
return( n * factorial(n-1));
}

Warning of using recursive function in C Programming :

  1. Recursive function must have at least one terminating condition that can be satisfied.
  2. Otherwise, the recursive function will call itself repeatably until the run time stack overflows.