#C - Recursion
Recursion is a method of calling a function inside a function iteratively.
void recursion() {
recursion(); /* function calls itself */
}
int main() {
recursion();
}
In this case the function recursion calls a copy of itself to work on a smaller problem until some conditional is satisfied.
Any function which calls itself is called recursive function, and such function calls are called recursive calls.
Recursion is a method of solving problems based on the divide and conquer mentality and we break the problem into much smaller sub part's of itself, one of the subpart consists the a conditional to break the recursion.
Example
Creating a recursive function to find the factorial of a number
Top comments (0)