#include<stdio.h>; #include<string.h>; void huiwen( const char* str) { int i; int flag; int len=strlen(str); char *ch=str; while(*ch!='\0') { ch++; } ch--; for(i=1;i<=len/2;i++) { if(*ch==*str) { flag=1; ch--; str++; } else { printf("不是回文字符串\n"); return; } } if(flag==1) { printf("是回文字符串\n"); } } int main() { char *str="123321"; huiwen(str); return 0; }
<img src="http://img.blog.csdn.net/20150406155720053?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvUzBTb3Vs/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />
原文地址:http://blog.csdn.net/s0soul/article/details/44902715