这是一个回文的程序,自己编的,可出现了好多问题, 我想让高手指点哈!
#include<stdio.h>#define num 20
typedef struct
{
char elem[num];
int top,r,p;
}seqstack;
int main()
{ int i,j,m,n;
seqstack s;
char c;
s->top=-1;
printf("Please input the num of the First sequence:");
scanf("%d",&n);
for(i=1;i<=n;i++)
{printf("Please input the characer:");
c=getchar();
if(c='&') continue;
s->top++;
s->elem[s->top]=c;
p=s->top;
}
s->top=s->top++;
s->elem[s->top++]='&';
r=s->top++;
printf(" input the number of the Second characters:");
scanf("%d",&m);
if (m!=n) return(ERROR);
for(j=1;j<=m;j++)
{printf(" input the character:");
c=gecher;
if(c='&') continue;
s->top++;
s->elem[s->top]=c;
}
match(p,r);
return(match);
}
int match(int *p,int *r)
{while(s-p!=0)
if(s->elem[s->p]==s->elem[s->r])
{s->p--;
s->r++;
return (TRUE);
}
else
return(FALSE);
}