Can anyone explain the recursion in C?

Login

0 votes

In programming, recursion is a function calling itself using the iterative approach to perform complex tasks. Here is an example to write recursive function in C:

void recursion() {

recursion(); /* function calls itself */

}

int main() {

recursion();

}

The C language supports recursion but you need to define an exit condition while defining recursion, otherwise it will go into an infinite loop.

Recursive functions are used for calculating the factorial of a number, generating the Fibonacci series, etc.

If you want to learn C programming, then check out this C Certification program by Intellipaat.

Also, watch this YouTube tutorial on C programming: