Script[gamemodes/****.amx]: Run time error 7: "Stack underflow"
#3

Quote:
Originally Posted by paytas
Thanks for attempting to help. I've tried to understand the underflow and overflow examples, although they don't seem to correspond with anything in pawno.

Code:
  int pop(STACK *ps)
  {
    if(empty(ps)){
      printf("Error: stack underflow");
      exit(EXIT_FAILURE);
    } else 
      return(ps->items[(ps->top)--]);
  }


  void push(int x, STACK *ps)
  {
    if(ps->top == STACKSIZE-1){
      printf("Error: stack overflow");
      exit(EXIT_FAILURE);
    } else 
      ps->items[++(ps->top)] = x;
      
    return;
  }
Reply


Messages In This Thread
Script[gamemodes/****.amx]: Run time error 7: "Stack underflow" - by Chaprnks - 30.08.2009, 20:03
Re: Script[gamemodes/****.amx]: Run time error 7: "Stack underflow" - by paytas - 30.08.2009, 20:42
Re: Script[gamemodes/****.amx]: Run time error 7: "Stack underflow" - by Chaprnks - 31.08.2009, 04:16

Forum Jump:


Users browsing this thread: 1 Guest(s)