data-structures · beginner · ~15 min
Check a palindrome from both ends inward.
Implement:
int is_palindrome(const char *s);
Return 1 if s reads the same forwards and backwards, checked recursively; else 0.
A string.
1 if palindrome, else 0.
Compare the outer pair, then recurse inward.
#include <stddef.h>
/* Return 1 if s reads the same forwards and backwards, checked recursively; else 0. */
int is_palindrome(const char *s){ (void)s; return 0; }
Not stopping when the two indices meet or cross.
Empty and single-character strings are palindromes.
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.