十进制转换八进制,代码哪里有问题?

#include<stdio.h>
typedef struct
{
int data[100];
int top;
int bottom;
}seqstack;
seqstack *L;
void init_stack(seqstack *&L)
{
L->top=-1;
L->bottom=-1;
}
void push_stack(seqstack *&L,int x)
{
if(L->top==9) printf("error");
else L->data[++L->top]=x;
}
void top_stack(seqstack *&L,int &x)
{
if(L->top==-1) printf("error");
else x=L->data[L->top];
}
void pop_stack(seqstack *&L,int &x)
{
if(L->top==-1) printf("error");
else x=L->data[L->top--];
}
int stack_empty(seqstack *&L)
{
if(L->top==-1) return 1;
else return 0;
}
void main()
{
int a,b,d;
printf("Which nunber do you want to change?");
scanf("%d",&a);
while(a!=0)
{
b=a%8;
push_stack(L,b);
a=a/8;
}
while(stack_empty(L)!=1)
{
top_stack(L,d);
printf("%d ",d);
pop_stack(L,d);
}
}
#include "stdio.h"

void main(void)
{
int buf[16], i = 0, n, k = 8; //k=进制

printf("纳迅Input a num : "); scanf("%d"大迹, &n); //输入

while(n > 0) { buf[i] = n % k; n /= k; i++; }

for (; i > 0; i--) printf("%d"滚茄并, buf[i - 1]);

printf("\n");
}