Define Recursion. Explain types and requirement of recursion ?
==> Recursion--
- A recursive function is a function which either calls itself or is in a potential cycle of function calls.
- As the definition specifies, there are two types of recursive functions. Consider a function which calls itself: we call this type of recursion immediate recursion and indirect recursion.
- Ex: Factorial is immediate recursive function.
void A() {
B();
return;
}
void B() {
C();
return;
}
void C() {
A();
return;
}