十进制转八进制用链栈写 显示没有错误,但是不能运行
#include<stdio.h>
#include<stdlib.h>
typedef struct aaa
{
char ch;
struct aaa *next;
}AAA;
int main()
{
AAA *p,*q,*s,*top;
int n;
top=(AAA *)malloc(sizeof(AAA));
top->next=NULL;
printf("请输入你想转换的数:");
scanf("%d",&n);
while(n)
{
s->ch=n%8;
n=n/8;
p->next=top->next;
top->next=p;
break;
}
printf("\n");
while(top!=0)
{
s=top->next;
printf("转换为:%d\n",top->next);
top->next=s->next;
free(s);
}
printf("栈已空!\n");
}