CS Electrical And Electronics
@cselectricalandelectronics

What is Recursive Functions?

All QuestionsCategory: C LanguageWhat is Recursive Functions?
Anonymous asked 3 years ago
1 Answers
Anonymous answered 3 years ago

An algorithm for solving a problem may be best implemented using a process called recursion. Consider the factorial of a number, which is commonly written as 5! = 5 * 4 * 3 * 2 * 1.
This calculation can also be thought of as repeatedly calculating num * (num -1) until num is 1.

A recursive function is one that calls itself and includes a base case, or exit condition, for ending the recursive calls. In the case of computing a factorial, the base case is num equal to 1.