这个代码怎么用了栈就不能输出结果了?
程序代码:
#include<stdio.h> #include<stdlib.h> #define MaxSize 10 typedef int ElemType; typedef struct { int data[MaxSize]; int top; }SqStack; void InikStack(SqStack *&s) { s=(SqStack *)malloc(sizeof(SqStack)); s->top=-1; } bool Push(SqStack *&s,ElemType e) { if(s->top==MaxSize-1) return false; s->top++; s->data[s->top]=e; return true; } bool Pop(SqStack *&s,ElemType e) { if(s->top==-1) return false; e=s->data[s->top]; s->top--; return true; } void zhuanhuan(int m) { int i,sum[23]; SqStack *s; ElemType e; while(m!=0) { sum[23]=m%2; m=m/2; for(i=0;sum[i]!='\0';i++) Push(s,sum[i]); for(i=0;sum[i]!='\0';i++) Pop(s,e); printf("%d",e);} } int main(void) { int n; printf("请输入一个十进制的数:"); scanf("%d",&n); zhuanhuan(n); }