Author(s) Arthur van Stratum & Cyril Pletinckx
Deadline No deadline
Submission limit No limitation

Sign in

[S2] Palindrome

Palindrome are strings of text which read the same backward as forward, i.e. : "racecar", "a man a plan a canal panama" or "kayak".

Write the body of the function pal which tells if the given string is a palindrome or not. Ignore spaces: for example, "kay a k" should be considered a palindrome. An empty string is considered a palindrome. You can use all the functions that are defined in string.h. You can't modify the initial string.

#include <string.h>
* @return: returns true (1) if str is a palindrome, -1 if str is NULL, otherwise false (0).
int pal(char *str) {