9.14.10-PointersOnC-20220302
作者:互联网
#include<stdio.h>
#include<string.h>
#include<ctype.h>
int is_palindrome(char *string);
int main(int argc,char *argv[]){
char str[]="Madam,I'm Adam";
fputs(is_palindrome(str)?"It's a palindrome.\n":"It's not a palindrome.\n",stdout);
return 0;}
//
int is_palindrome(char *string){
char *prear=string+strlen(string)-1;
for(;string<prear;){
for(;!isalpha(*string);string++);
for(;!isalpha(*prear);prear--);
if(tolower(*string++)!=tolower(*prear--)) return 0;
}
return 1;}
标签:10,20220302,string,int,9.14,char,palindrome,str,include 来源: https://blog.csdn.net/fleet1126/article/details/123227119