Introduction to Recursion : C Programming
Recursion Concept :
- Recursion is basic concept in Programming.
- When Function is defined in terms of itself then it is called as “Recursion Function“.
- 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 :
- Recursive function must have at least one terminating condition that can be satisfied.
- Otherwise, the recursive function will call itself repeatably until the run time stack overflows.