Recursion in C, understand recursion example

后端 未结 6 1322
轮回少年
轮回少年 2021-01-27 20:30

i am having trouble understanding this example. I cant figure out what actually happens after a certain point.

Here is the code, the result is supposed to be 4.

6条回答
  •  迷失自我
    2021-01-27 21:28

    Here from code, recursion(1) = 3 and i/2 when i>1 , 9/2 = 4 (since int as parameter)

    The base condition of this recursive function is when i = 1 Recursion explained myself with a diagram]

提交回复
热议问题