+ 2

Could anyone tell me what is the meaning of a (Recursive function) used in c++ ??

18th Dec 2017, 8:21 PM
RiGeL
RiGeL - avatar
2 ответов
+ 2
When you're calling the same function inside the function, using given arguments to evaluate what to do. //call countToTen(0); . . . // definition void countToTen(int currentCount){ if (currentCount <= 10) { std::cout << currentCount << " "; countToTen(currentCount++)} } It keeps printing currentCount and calling itself with an increment and stops when currCount is no longer <=10. Output should be 0 1 2 3 4 5 6 7 8 9 10
18th Dec 2017, 8:32 PM
Echo One
Echo One - avatar
+ 2
@Echo thank you alot
18th Dec 2017, 8:34 PM
RiGeL
RiGeL - avatar