mirror of
https://github.com/renbaoshuo/202401-programming-assignments.git
synced 2024-12-16 15:44:39 +00:00
15 lines
206 B
C
15 lines
206 B
C
|
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;
|
||
|
}
|