Sunday 25 September 2011

Checking stack is full (stack overflow) or not?



OVERFLOW OF STACKS:

Stack is a specific amount of memory assigned to a program to use. A stack overflow means that this stack is full and you can't insert anymore data into it

int isfull()
{
 return(top==size-1);
}
//Note: this is the logic to check whether the stack is overflow or not?
here top is the subscript of stack last inserted value, and size is the stack array size.
Basic stack operation
 Stack

No comments:

Post a Comment