+ 2

About Recursive function can anyone explain well to me?? I didnt understand it while learning course.😅??

Recursive Function C Language.

5th Jan 2023, 2:06 AM
Pratikshya
Pratikshya - avatar
3 Antworten
+ 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
5th Jan 2023, 3:18 AM
Hirakjyoti Medhi
Hirakjyoti Medhi - avatar
+ 1
Ptshya Bahing no problem feel free to ask anything anytime!👍
5th Jan 2023, 11:16 AM
Hirakjyoti Medhi
Hirakjyoti Medhi - avatar
0
Thankyou 🌻
5th Jan 2023, 11:14 AM
Pratikshya
Pratikshya - avatar