Explain following terms ..
a. Recursive function
b. Base case of recursion
IN C LANGUAGE
a. Recursive function:
A recursive function is a function that calls it self.
Example code:
int f(n)
{
if(n==1)
{
return 1;
}
else
{
return n+f(n-1)
}
}
b.Base case of recursion:
Base case of recursion is the case at which recursive function terminates. Any recursive functionshould have to end at some point and recursive function executes till it reaches the base case.
In the above example the below one is the base case of recursive function.
if(n==1)
{
return 1;
}
Get Answers For Free
Most questions answered within 1 hours.