how to overcome stack overflow???

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??

Parents Reply Children
  • 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!

More questions in this forum