帮忙看个程序呗!是用C语言写的区域填充有关问题

帮忙看个程序呗!是用C语言写的区域填充问题!
#include   "stdio.h "
#include   "graphics.h "
#define     MAX   600
#define     FALSE   0
#define     TRUE   1
typedef   struct
{
  int   x;
  int   y;
}elemtype;
typedef   struct
{
elemtype   data[MAX]   ;
int   top;
int   size;
}sta   ;
void   init(sta   *stack)
{stack-> top=0;
  stack-> size=0;
}

int   isstackempty(sta   *stack)       /*判断栈是否为空*/
{
  if   (stack-> size==0)
    return   1;
  else
    return   0;


}
void   stackpush(sta   *stack,elemtype   point)     /*压栈*/
{
      stack-> top++;
      stack-> data[stack-> top]=point;
      }
elemtype   stackpop(sta   *stack)     /*出栈,并且返回值*/
{
return   stack-> data[stack-> top--];

}

void   scanlinefill(int   x,int   y,int   oldcolor,int   newcolor)
{
int   xl,xr;
int   spanneedfill;
elemtype   pt;
sta   stack;
init(&stack);
pt.x=x;
pt.y=y;
stackpush(&stack,pt);
while(!isstackempty(&stack))
{
      pt=stackpop(&stack);
      y=pt.y;
      x=pt.x;
      while(getpixel(x,y)==oldcolor)
        {
            putpixel(x,y,newcolor);
            x++;
        }
      xr=x-1;
      x=pt.x-1;
      while(getpixel(x,y)==oldcolor)
        {
            putpixel(x,y,newcolor);
            x--;
        }
      xl=x+1;
      x=xl;
      y+=1;
      while(x <xr)
        {
            spanneedfill=FALSE;
            while(getpixel(x,y)==oldcolor)
                {
                    spanneedfill=TRUE;
                    x++;
                }
            if(spanneedfill)
              {
                  pt.x=x-1;
                  pt.y=y;
                  stackpush(&stack,pt);
                  spanneedfill=FALSE;
              }
              while(getpixel(x,y)!=oldcolor&&x <xr)x++;
        }
        x=xl;
        y=y-2;
        while(x <xr)
          {
              spanneedfill=FALSE;