STACK OVERFLOW
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:
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(); }
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++] =top
Stack overflow condition is raised when Top=max-1 where max is the size of the array n, Top is the topm ost element.
No comments:
Post a Comment