出错处以标出,不知道该如何改
#include<stdio.h>
#include<malloc.h>
#define  stack_init_size  10;
#define   stackincrement  10;
typedef struct stack
{
int   *base;
int   *top;
int stacksize;
};
 struct stack initstack()
{
struct stack  s;
s.base=(int *) malloc (stack_init_size * sizeof(int));//出错
if(s.base==NULL)  printf("error");
s.top=s.base;
s.stacksize=stack_init_size;
return   s;
}
void push(struct stack s,int a)
{
if(s.top-s.base>=s.stacksize)
{
s.base=(int*)realloc(s.base, (stack_init_size+stackincrement)*sizeof(int));//出错
if(!s.base)  printf("error!");
s.top=s.base+s.stacksize;
s.stacksize+=stackincrement;
}
*s.top++=a;
}
int  gettop(struct stack s)
{
    int e;
if(s.top==s.base)  return  0;
e=*s.top++;
return e;
}
int stackempty(struct stack s)
{
if(s.base!=s.top)  return  0;
else   return 1;
}
int main()
{
int n,e;
struct stack   s;
s=initstack();
printf("input an int number:");
scanf("%d",n);
while(n)
{
push(s,n%8);
n=n/8;
}
while(!stackempty(s))
{
e=gettop(s);
printf("%d",e);
s.top--;
}
return 0;
}



											
	    

	
											

