0
In this code how is stop ?it have been writen in the course of c++
int factorial(int n) { if (n==1) { return 1; } else { return n * factorial(n-1); } }
6 ответов
+ 12
On every value you pass, you see that the function calls itself again but when the value is 1, the function returns a raw number (1) and does not call itself again...
+ 2
thanks Valen.H. ~
+ 1
every time the function is called the parameter 1 smaller. it stops when the parameter reaches 1
+ 1
because it returns 1 if n = 1 and then the function that called it returns and so on
0
why it's stop in the 1
0
thank for explication