1
0
mirror of https://github.com/renbaoshuo/202401-programming-assignments.git synced 2024-12-16 15:44:39 +00:00
202401-programming-assignments/【实践课外】13.指针1/6-6 判断回文字符串.c

15 lines
206 B
C
Raw Permalink Normal View History

2024-11-29 08:43:30 +00:00
bool palindrome(char *s) {
int p = 0,
q = strlen(s) - 1;
while (p < q) {
if (s[p] != s[q]) {
return false;
}
p++;
q--;
}
return true;
}