diff --git a/testcase/userstack.c b/testcase/userstack.c new file mode 100644 index 0000000..ad6d4ba --- /dev/null +++ b/testcase/userstack.c @@ -0,0 +1,35 @@ +#include +#include + +void customFunction1(int n); +void customFunction2(int n); +void customFunction3(int n); + +void customFunction1(int n) { + if(n <= 0) { + printf("End of recursion\n"); + while (1) { + // sleep(1); + } // never return, keep stack + return; + } else { + printf("Calling customFunction2\n"); + customFunction2(n-1); + } +} + +void customFunction2(int n) { + printf("Calling customFunction3\n"); + customFunction3(n); +} + +void customFunction3(int n) { + printf("Calling customFunction1\n"); + customFunction1(n); +} + +int main() { + customFunction1(10); + + return 0; +} \ No newline at end of file