(e-mail address removed) said:
I am using Visual C++ 6 IDE,with 512MB RAM. I have coded a recursive
function that has a correct end condition for recursion. There is no
infinite recursion.
For some input data,the recursive function gets called so many times
that it causes a 'First-chance exception in a.exe: 0xC00000FD: Stack
Overflow.'
How do i increase the size of the program stack?
As regular readers of this newsgroup are well aware, C programs don't have
a stack. Nevertheless, the size of this non-existent stack is indeed
configurable in Visual C++ 6.
Go to the "Project" menu, and select the "Settings" submenu. You get a
tabbed dialog. Select the "Link" tab. On that tab is a dropdown menu,
entitled "Category". Pull it down and select "Output".
Now you should see a groupbox entitled "Stack Allocations", containing a
textbox entitled "Reserve". In here, put in the size (in bytes) of the
stack that you want your C program to have.
BUT! The default stack size is 1MB, which really ought to be ample
(especially for something that doesn't even exist!). If a recursive
solution doesn't fit in a meg, recursion may not be the best way to solve
the problem. Take a long, hard look at your design.
Finally - strictly speaking, your question is about an implementation
rather than the language itself, and such questions really belong in
implementation-specific newsgroups, or at least platform-specific
newsgroups. For further reference, I can thoroughly recommend
comp.os.ms-windows.programmer.win32, and you may also find the Microsoft
newsgroups to be of some use.