这是我的回文的程序,可以运行,但出不来结果,希望那个高手指点哈,谢谢大家了!
#include <stdio.h>#define N 20
#define ERROR -1
#define TRUE 1
typedef struct
{char elem[N];
int top[2];
}seqstack;
int main()
{int i,j,m,n;
seqstack *s;
char c;
printf(" please input the num of the first sequence :\n");
scanf("%d",&n);
for( i=1;i<=n;i++)
{printf("please input the characters:\n");
c=getchar();
if(c='&') continue;
s->elem[s->top[0]]=c;
s->top[0]++;
}
printf("input the nem of the second sequence:");
scanf("%d",&m);
if( m!=n) return(-1);
if( m+n>=N) return(-1);
for(j=1;j<=m;j++)
{printf(" please input the characters:");
c=getchar();
if(c='&') continue;
s->top[1]--;
s->elem[s->top[1]]=c;
}
while (s->top[0]!=0&&s->top[1]!=0)
{
{while(s->elem[s->top[0]]==s->elem[s->top[1]])
{s->top[0]--;
s->top[1]++;
}
return(1 );
}
}
}