0
what is recursive function
6 Respostas
+ 3
As Cohen said, a recursive function is a function that calls itself, until it reaches a base case.
Here is a concrete example:
unsigned int factorial(unsigned int n) {
if (n == 0) {
return 1;
} else {
return n * factorial(n-1);
}
}
+ 1
A recursive function is simply a function that calls itself. For example, if some code is running inside a function, and you want to return to the beginning of that function, perhaps with incremented values etc, you can call that function inside itself. You just used recurssion.
+ 1
a function which calls itself until the terminating condition comes is known as recursive function... It uses stack to do recursion.
0
"A useful way to think of recursive functions is to imagine them as a process being performed where one of the instructions is to "repeat the process".
0
A recursive function (DEF) is a function which either calls itself or is in a potential cycle of function calls. As the definition specifies, there are two types of recursive functions. Consider a function which calls itself: we call this type of recursion immediate recursion.
0
A recursive function is one that calls itself. Most useful is usually for sorting.