请问这道c语言题怎么写?

2025-04-09 21:04:18
推荐回答(1个)
回答1:

#include 
int func(char *s)
{
    char *p;
    for(p=s;*p;p++);
    for(p--;s        if(*s!=*p)
            return 0;
    return 1;
}
int main()
{
    char s[100];
    gets(s);
    puts(func(s)?"YES":"NO");
    return 0;
}