Palindrome
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version.
Palindrome
Return 1 if a C-string reads the same in both directions, otherwise 0 — in C there's no bool by default, so we use the integers 1 and 0. Compare characters from the two ends moving inward.
Complete int is_palindrome(const char *s) to return 1 if s reads the same forwards and backwards, otherwise 0.
Click Run to see the output here.