userstack

This commit is contained in:
zy
2023-11-21 04:43:30 -05:00
parent 6c105992fd
commit 8fc4155b73

35
testcase/userstack.c Normal file
View File

@@ -0,0 +1,35 @@
#include <stdio.h>
#include <unistd.h>
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;
}