I have one question about stack size
Code:
int StackSize(Stack *s)
{
int count=0;
if(Push(item, *s))
count++;
else if (Pop(*item,*s))
count--;
return count;
}
i have other errors in my code, so i dont know if this is legal, the prototype for push is
int Push(StackE item, Stack *s)
int Pop(StackE *item, Stack *s)
or should do something with my top var to get the size?
also for my Push
Code:
int Push(StackEntry item, Stack *s) {
Node *nptr = MakeNode(item);
{
*nptr = s->top;
if(StackFull(s)) return 1;
else
{
*item = nptr->entry;
s->top++ = nptr->next;
return 0;
}
}
Thanks for the help