Informations

Auteur(s) Arthur van Stratum & Cyril Pletinckx
Date limite Pas de date limite
Limite de soumission Pas de limite
Étiquettes de catégories String, S2, Level 3

Etiquettes

Se connecter

[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) {