Palindrome · 回文
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version. · 此页面需较新浏览器(支持 SharedArrayBuffer)。请升级 Chrome、Edge、Firefox 或 Safari 至最新版本。
English
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.
中文
回文
如果 C 字符串正反读相同就返回 1,否则返回 0 —— C 默认没有 bool 类型,所以我们用整数 1 和 0。从两端向中间逐个比较字符。
Complete int is_palindrome(const char *s) to return 1 if s reads the same forwards and backwards, otherwise 0. · 完成 int is_palindrome(const char *s),如果 s 正读和反读相同就返回 1,否则返回 0。
Click Run to see the output here. · 点击“运行”查看此处输出。