asit wrote:
we kno during call of a subroutine, the address of next
instruction( from which the execution is supposed to start after the
subroutine is executed ) is stored in stack.
We know (note spelling) no such thing. There are many ways for
subroutines to be supplied with the location to which returns should
lead, and many ways for subroutines to use such information.
Any question based upon your false premise is useless. However,
in case of recursion
(e.g. we are sorting an array having length one million using heap
sort), we have to call a particular subroutine thousands time. Is
their any chance of stack overflow ?? if yes how can we avoid ??
Unless you somehow have access to an infinite memory machine, it is
obvious that any unrestrained use of a stack carries with it the chance
of overflowing that stack. It doesn't matter what use you put that
stack to. There is no automatic way of avoiding violating the limits of
any region of memory. As to which precautions you should take, that
is obviously intimately bound to your implementation. Knowledge of your
implementation and the skills to use that knowledge have nothing to do
with the C programming language and are off-topic in <news:comp.lang.c>