求指教,指出错误。
#include <stdio.h>#include <stdlib.h>
typedef struct //结构体里面有两个整型指针:Top\Bottom;
{
int *Top;
int *Bottom;
} Stack;
Initstack(Stack *s)//创造一个栈,并且初始化;
{
s->Top=(int *)malloc(sizeof((int *)100));
s->Bottom=s->Top;
}
int push(Stack *s,int n)//余数入栈;
{
if(s->Top-s->Bottom!==100)
else {
*s->Top=n;
s->Top++;}
}
int Pop(Stack *s,int e)//弹栈;
{
if(s->Top!==s->Bottom)
else {
s->Top--;
e=*s->Top;}
return e;
}
main()//主函数
{
Stack s;
int n,e;
printf("请输入一个正整数:");
scanf("%d",&n);
while(n!=0)
{
push(s,n%8);
n=n/8;
}
while(s->Top!=s->Bottom)
{
e=Pop(s,e);
printf("%3d",e);
}
printf("\n");
}