主题:堆栈与结构体的问题
typedef struct{
int ord;
postype seat;
int di;
}SELEMTYPE;
typedef struct{
SELEMTYPE *base;
SELEMTYPE *top;
int stacksize;
}*sqstack;
status push(sqstack s,SELEMTYPE e)
{while(s->top-s->base>=s->stacksize)
{s->base=(SELEMTYPE*)realloc(s->base,(s->stacksize+STACKINCREMENT)*sizeof(SELEMTYPE));
if(!s->base)exit(OVERFLLOW);
s->top=s->base+s->stacksize;
s->stacksize+=STACKINCREMENT;
}
*s->top++=e;
return(OK);
}
SELEMTYPE e;
push(s,e);可以实现吗?
有人在吗?
大家讨论一下啊
就是说把结构体定义的变量进行栈的超作吗?
int ord;
postype seat;
int di;
}SELEMTYPE;
typedef struct{
SELEMTYPE *base;
SELEMTYPE *top;
int stacksize;
}*sqstack;
status push(sqstack s,SELEMTYPE e)
{while(s->top-s->base>=s->stacksize)
{s->base=(SELEMTYPE*)realloc(s->base,(s->stacksize+STACKINCREMENT)*sizeof(SELEMTYPE));
if(!s->base)exit(OVERFLLOW);
s->top=s->base+s->stacksize;
s->stacksize+=STACKINCREMENT;
}
*s->top++=e;
return(OK);
}
SELEMTYPE e;
push(s,e);可以实现吗?
有人在吗?
大家讨论一下啊
就是说把结构体定义的变量进行栈的超作吗?