Explaining needed C recursion

后端 未结 2 1320
不知归路
不知归路 2020-12-22 00:24

I need some help with this particular code. I do not really understand it to its fullest. Could someone take the time and explain it to me? What it does is take a word and p

2条回答
  •  误落风尘
    2020-12-22 01:23

    It is indeed a bit difficult to get; the reversal by recursion works by recursively getting more and more characters from the input until some terminal symbol ' ' is entered. The input is stored implicitly on the stack, until it is printed at the termination of each recursive call of reverse.

    Note that the characters are only printed to the output, but they are not stored anywhere for later access; they cannot be obtained again as soon as the first call of reverse terminates.

提交回复
热议问题