As others have noted, you're experiencing stack overflow.
Calling a function requires stack allocations for
parameter passing, storing return addresses, etc.
Recursion can result in using up all of the
available reserved stack size, which in VS is
1 MB by default. You can reserve more by setting
the reserve size in the project properties as already
Another way to reserve a larger stack is via the pragma
directive. Try placing the following pragma at the
start of your program to reserve a 4 MB stack:
#pragma comment(linker, "/STACK:4000000")
Note that regardless of the stack size there will
always be a limit which you may exceed if you do
deep enough recursion. Therefore recursion should
be replaced with other techniques if a very large
number of recursions is expected in normal use.
Note as well that other activities in a program will
also be using stack space, so the actual amount
available for recursion is dependent on the overall
program requirements. For example, a large local
static array may take up a lot of stack.