//判断一个字符串是不是回文字符串 #include <stdio.h> #include <assert.h> int panduan( char *p ) { char *q ; assert( *p != NULL ); q = p; while( *p != '\0') { p++; } p--; while(*q != '\0') { if( *p == *q) { p--; q++; } else return -1; } return 1; } int main() { char p[] = "12321"; printf("%d\n",panduan(p)); return 0; }
原文地址:http://blog.csdn.net/zhaoyaqian552/article/details/44855409