判断回文

软件工程马搏 edited 4 年前

include

int is_reverse(char s)
{
char
p = s;
while(p) p++;
p–;
while(p>s)
{
if(
p != *s) break;
p–;
s++;
}
return p<=s;
}

int main()
{
char str[80];
gets(str);
if(is_reverse(str)) puts(“True”);
else puts(“False”);

return 0;

}

Comments