#include"stdio.h"
#include"string.h"
#define N 20
int main()
{
char str[N];
printf("please input a string...\n");
gets(str);
int high,low;
for(low=0,high=strlen(str)-1;low<high;low++,high--)
if(str[low]!=str[high])
{
printf("NO\n");
break;
}
if(low>=high)
printf("Yes\n");
return 0;
}
本文介绍了一个简单的C语言程序,用于判断用户输入的字符串是否为回文字符串。通过使用gets()函数读取输入,并利用指针技巧比较字符串首尾字符来实现功能。

1149

被折叠的 条评论
为什么被折叠?



