First of all, it is not C, which limits recursion . This is your operating system!
This is because recursion uses the stack. Do you know what a stack is ? This is the application’s memory area that is used to store (local) variables or parameters that need to be sent from one function to another during a function call. It also stores other information, such as the address of the function, to which it should return after executing the current one.
Now you see that infinite recursion is a problem because after each recursion more data is stored on the stack, and since these functions are never returned, their resources on the stack are also never freed. At some point, the stack will run out of memory and it will explode in your face.
On Windows, if you need to increase the size of the stack, you can try this .
source share