This simple C program rarely terminates at the same call depth:
#include
#include
void recursive(unsigned int rec);
int ma
There is a gap between the stack segment and the heap segment. Now because the size of heap is variable( keeps on changing during execution), therefore the extent to which your stack will grow before stackoverflow occurs is also variable and this is the reason why your program rarely terminates at the same call depth.