#include <stdio.h>#include <stdlib.h>#include <malloc.h>#define STACK_INIT_SIZE 100#define STACKINCREMENT 10typedef struct SqStack{ int *base; int *top; int stacksize;} SqStack;void InitStack(SqStack *S){ S->base=(int*)malloc(STACK_INIT_SIZE*sizeof(int)); S->top=S->base; S->stacksize=STACK_INIT_SIZE;}void Push(SqStack *S,int e){ if(S->top-S->base>=S->stacksize) { S->base=(int*)realloc(S->base, (S->stacksize+STACKINCREMENT)*sizeof(int)); S->top=S->base+S->stacksize; S->stacksize+=STACKINCREMENT; } *(S->top)=e; S->top++;}int Pop(SqStack *S){ S->top --; return *S->top;}int StackEmpty(SqStack *S){ if(S->top == S->base ) return 1; else return 0;}void conversion(int a){ SqStack S;int e; InitStack(&S); while(a) { Push(&S,a%2); a=a/2; } while(!StackEmpty(&S)) { e=Pop(&S); printf("%d",e); } }void main(){ int a; printf("输入个十进制数\n"); scanf("%d",&a); printf("二进制为:\n"); conversion(a); }这样的,有问题联系