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 just want to avoid stack overflow while working with recursive functions........"
You could use assembler to manipulate the stack. But to what purpose?
If your recursive function needs storage, then it simply needs storage. What would you attempt to do? put a temporary stack somewhere else? The total of space required would surely still be the same, so why go to the trouble?
Surely you have two options: 1) Increase the allocation for the stack. 2) Consider re-writing your routines so they don't require recursion.
The only real purpose I can think of is to detect when you're about to run out of stack, and stop the recursion there?
Not sure how actually useful that'd be, though...?
Again, the safest way to avoid problems due to recursion is: don't do recursion!
If you don't do it, then it obviously can't cause you any problems!