#include
#include
int fun(char s[])
{ int b,i,t;
char a[100];
b=strlen(s);
t=b;
i=0;
while(i!=t)
{
a[i]=s[b-1];
b--;
i++;
}
a[i]='\0';
if(!strcmp(s,a))
return 1;
else
return 0;
}
void main()
{
char s[100];
int b,i,t;
printf("请输入字符串:");
scanf("%s",s);
i=fun(s);
if(i==1)
printf("这是回文串!\n");
else
printf("这不是回文串!\n");
}
int fun (char* p, int n )
{
int i,j=0;
while(*p != 0){
if (*p != *(p+n-1)){
i=0;
continue;
}
p++;
j++;
}
if(j==n){
i = 1;
}
return i
}