#include<stdio.h>
#include<stdlib.h>
#define MAXSIZE 100
#define OK 1
#define ERROR 0
typedef int DataType;
typedef struct{
DataType data[MAXSIZE];
int top;
}SeqStack,*PSeqStack;
PSeqStack Init_SeqStack(void){
PSeqStack S;
S=(PSeqStack)malloc(sizeof(SeqStack));
if(S)
S->top=-1;
return S;
}
int Empty_SeqStack(PSeqStack S){
if(S->top==-1)
return 1;
else return 0;
}
int Push_SeqStack(PSeqStack S,DataType x){
if(S->top==MAXSIZE-1)
return 0;
else
{
S->top++;
S->data[S->top]=x;
return 1;
}
}
int Pop_SeqStack(PSeqStack S,DataType *x){
if(Empty_SeqStack(S))
return 0;
else{
*x=S->data[S->top] ;
S->top--;
return 1;
}
}
int main(){
PSeqStack S;
Init_SeqStack();
Empty_SeqStack(S);
int n=0,a,b,x;
printf("请输入一个整数n:",n);
scanf("%d",&n);
do{
a=n/2;
b=n%2;
Push_SeqStack(S,b);
n=a;
}while(a>0);
Pop_SeqStack(S,b);
return(0);
}报错在说push和Pop说明声明
#include<stdio.h>
#include<stdlib.h>
#define MAXSIZE 100
#define OK 1
#define ERROR 0
typedef int DataType;
typedef struct{
DataType data[MAXSIZE];
int top;
}SeqStack,*PSeqStack;
PSeqStack Init_SeqStack(void){
PSeqStack S;
S=(PSeqStack)malloc(sizeof(SeqStack));
if(S)
S->top=-1;
return S;
}
int Empty_SeqStack(PSeqStack S){
if(S->top==-1)
return 1;
else
return 0;
}
int Push_SeqStack(PSeqStack S,DataType* x){
if(S->top==MAXSIZE-1)
return 0;
else
{
S->top++;
S->data[S->top] = *x;
return 1;
}
}
int Pop_SeqStack(PSeqStack S,DataType *x){
if(Empty_SeqStack(S))
return 0;
else
{
*x=S->data[S->top] ;
S->top--;
return 1;
}
}
int main()
{
//PSeqStack S;
int* b = 0;
Empty_SeqStack(Init_SeqStack());
int n = 0, a;
printf("请输入一个整数n:",n);
scanf("%d",&n);
do{
a=n/2;
*b=n%2;
Push_SeqStack(Init_SeqStack(),b);
n=a;
}while(a>0);
Pop_SeqStack(Init_SeqStack(),b);
return(0);
}
你这个要实现什么????