Stack Overflow

How will you identify Stack Overflow?

Questions by swetha_joein

Showing Answers 1 - 18 of 18 Answers

In software stack will overflow when there will more amount of memory required to call the stack. As we all know in every language there are different rules with the memory requirement for the stack call.

In programming if the start On modern operating systems, a typical stack has at least 1 megabyte, which is sufficient for most purposes. Under anomalous conditions, the program exceeds its stack limit. This causes a stack overflow.
The two most common causes for a stack overflow is an infinite recursion, as in:

 int f(){  g(); } int g() {  f();   } 

  Was this answer useful?  Yes

Stack overflow will happen only in static stack.


Suppose consider a[10] as a stack, top is the last available elment in the stack, max is the index of the top i.e 9. Overflow will happen only at pushing en element. Here is the code.

push(int value)
{
  if(top >= max)
    printf("Stack overflow");
  else
    a[top++] = value;
}

ahatesham ahamed

  • Jan 6th, 2018
 

How to minimize overflow in stack?

  Was this answer useful?  Yes

prem waghmare

  • Sep 11th, 2018
 

What is stack overflow and underflow condition with example?

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions