0 votes
1 view
in C Programming by (36k points)
recategorized by
Can anyone explain the recursion in C?

1 Answer

0 votes
by (86.8k points)

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:

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...