中间的黑体带下划线的那句话错了,各位大虾请赐教
#include "stdio.h"
#include "conio.h"
#include "malloc.h"
#define LISTSTACK
#define stack
void main()
{
int number,ch,s;
stack s;
initstack(&s);
printf("input data:");
scanf("%d",&number);
while(number)
{ push(&s,number%2);
number=number/2;
}
while(!stackempty(s))
{ pop(&s,&ch);
printf("%d",ch);
}
getch();
}
/* */
#define stack_size 100
typedef int elemtype;
typedef struct {
elemtype item[stack_size];
int top;
}stack;
/* */
void initstack(stack *s)
{s->top=-1;}
/* */
int stackempty(stack s)
{
if (s.top==-1) return 1;
else return 0;
}
/* */
void push(stack *s,elemtype item)
{
if(s->top==stack_size-1) printf("stack is full!");
else
{ s->top=s->top+1;
s->item[s->top]=item;
}
}
/* */
void pop(stack *s,elemtype *item)
{
if(stackempty(*s)) printf("error");
else *item=s->item[s->top--];
}
/* */
void gettop(stack s,elemtype *item)
{
if(stackempty(s)) printf("stack is empty!");
else *item=item[s.top];
}