Top of the Stack:

Last Pushed Item:

Last Poped Item:

Size of the Stack:

top
This is a message box

PUSH ALGORITHM

void push(int x){
if(top==size-1){
printf("STACK OVERFLOW");
}
else{
top++;
stack[top]=x;
}
}

POP ALGORITHM

int pop(){
int x;
if(top==-1){
printf("STACK UNDERFLOW");
}
else{
x=stack[top];
top--;
}
return x;
}