这个代码只能用来判断长度为5的字符串是否回文,因为它只判断了字符串的前两个字符和后两个字符是否相等,而且只判断了两次。如果字符串长度不为5,或者字符串中间有不同的字符,或者有奇数个字符,那么这个代码就不能正确判断字符串是否回文。

#include stdioh#include stringhint main char a32; getsa; int n = strlena; int flag = 1; for int i = 0; i 2; ++i ifa0 == a4 && a1 == a4 flag = 1; else

原文地址: https://www.cveoy.top/t/topic/bWgs 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录