Runtime exception, recursion too deep

后端 未结 12 979
余生分开走
余生分开走 2020-12-19 04:59

I converted the pseudo-code here into C#, and have it recursively repeat 10,000 times. But I get a C# runtime error, StackOverflow Exception after 9217

12条回答
  •  北海茫月
    2020-12-19 05:28

    Don't use recursion. This is a good sample case of when you should not recurse, as you will cause a call stack overflow.

    You can probably convert that to non-recursive easily.

提交回复
热议问题