/* Push Operation */
int stack_push(struct Stack* s, item n)
{
if(stack_full(*s))
return -1;
else
s->data[s->pos++] = n;
return 1;
}
/* Pop Operation */
int stack_pop(struct Stack* s, item* n)
{
if( stack_empty(*s))
{
*n = -1;
return -1;
}
else
*n = s->data[--s->pos];
return 1;
}
/* Top Operation */
int stack_top(const struct Stack s, item* n)
{
if(stack_empty(s))
{
*n = -1;
return -1;
}
else
*n = (&s)->data[(&s)->pos - 1];
return 1;
}