#include <携州cstdio>
#include <腔搭cstdlib>
#include
#define CHECK(A) (((A) >= 'a' && (A) <= '伍隐拿z')) || ((A) >= 'A' && (A) <= 'Z')
int IsPalindromeStr(char * string)
{
if(NULL == string)
{
return 0;
}
if(strlen(string) == 1 && CHECK(*string))
{
return 1;
}
int len = strlen(string);
char *first = string;
char *end = &(*(first + len - 1));
for(; (first <= end); )
{
if(CHECK(*first) && CHECK(*end) && (*first != *end))
{
return 0;
}
if(CHECK(*first) && !CHECK(*end))
{
end--;
continue;
}
if(!CHECK(*first) && CHECK(*end))
{
first++;
continue;
}
first++;
end--;
}
return 1;
}
写个主函数,调用下就OK了