How does recursive function works? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

How does recursive function works?

💐🏵🌷🌻🌺🥀🌹💮⚘🍂🍃

29th Dec 2018, 2:12 PM
Nithya Yamasinghe
Nithya Yamasinghe - avatar
3 Answers
+ 4
It's a function which calls itself. You should declare a base case (termination condition - condition which stops the recursion). It's explained in C++ course: https://www.sololearn.com/learn/CPlusPlus/1641/.
29th Dec 2018, 2:29 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 4
You have to ensure that the base case will always be reached. Otherwise you will get infinite recursion.
14th Apr 2019, 7:37 AM
Sonic
Sonic - avatar
+ 3
This is the program I wrote. I'm a beginner, so I'm not sure it's all correct. https://code.sololearn.com/c4bzn4ZfKmt5/#c
30th Dec 2018, 1:05 PM
Konybud
Konybud - avatar