0% found this document useful (0 votes)
30 views

Recursion

Recursion is a process where a function calls itself repeatedly, either directly or indirectly, and requires an exit condition to prevent infinite looping. Recursive functions are useful for solving mathematical problems like calculating factorials or generating Fibonacci series by repeating a process in a self-similar manner. Programmers must implement a stopping condition when using recursion to ensure the function exits at some point.

Uploaded by

Abhishek Dargan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

Recursion

Recursion is a process where a function calls itself repeatedly, either directly or indirectly, and requires an exit condition to prevent infinite looping. Recursive functions are useful for solving mathematical problems like calculating factorials or generating Fibonacci series by repeating a process in a self-similar manner. Programmers must implement a stopping condition when using recursion to ensure the function exits at some point.

Uploaded by

Abhishek Dargan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Recursion is the process of repeating items in a self-similar way.

In programming languages,
if a program allows you to call a function inside the same function, then it is called a
recursive call of the function.

The C programming language supports recursion, i.e., a function to call itself. But while
using recursion, programmers need to be careful to define an exit condition from the function,
otherwise it will go into an infinite loop.

Recursive functions are very useful to solve many mathematical problems, such as
calculating the factorial of a number, generating Fibonacci series, etc.

The recursion continues until some condition is met to prevent it.

To prevent infinite recursion, if...else statement (or similar approach) can be used where one
branch makes the recursive call and other doesn't.

You might also like