C语言一个关于回文的问题
#include<stdio.h>
#include<string.h>
void main()
{
int i;
char word[20];
char *ptr_word1,*ptr_word2;
printf("Enter a string:");
scanf("%s",word);
for(i=0;i<=strlen(word);i++)
{
ptr_word1=&word[i];
}
for(i=strlen(word);i>=0;i--)
{
ptr_word2=&word[i];
}
if(*ptr_word1==*ptr_word2)
printf("Yes");
else printf("No");
}
我这样写哪里不对啦 ?
回文的意思就是说输入一个字符串比如abcba就是 sdjfsf就不是 就是正过来倒过来都是一样