+ 2
About Recursive function can anyone explain well to me?? I didnt understand it while learning course.😅??
Recursive Function C Language.
3 ответов
+ 2
When a function calls itself, it is called recursion and this type of functions are called recursive function. Let's take the example of a find factorial function:
int findFactorial(int x){
int n = x;
if (n >=1){
return n * findFactorial(n-1);
} else {
return 1;
}
}
Here in this function we are taking a number as argument and then initialise that as variable n
Then if the value of n is greater than or equal to 1 we are returning the value of 'n' along with calling the same function again but with giving argument n-1 then the control flow will again go to that function and until the value of n becomes 0 it will repeat the same thing when n becomes 0 it will return only 1
+ 1
Ptshya Bahing no problem feel free to ask anything anytime!👍
0
Thankyou 🌻