We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
hello I am using ARM7 LPC2148. in the program I have to use recursive function. so there are lots of chances of stack overflow. how to avoid this??
I thought so, but wasn't quite sure.
Do you have a reference for that?
See:
en.wikipedia.org/.../Recursion_(computer_science)#Recursion_versus_iteration
(you'll need to copy & paste that - the forum can't cope with making it clickable)
"Another possible reason for choosing an iterative rather than a recursive algorithm is that in today's programming languages, the stack space available to a thread is often much less than the space available in the heap, and recursive algorithms tend to require more stack space than iterative algorithms."
So, again, if you're worried about stack space, don't use recursion!