Información

Autor(es) Arthur van Stratum & Cyril Pletinckx
Fecha de entrega Sin fecha de envío
Tiempo límite de envío Sin límite de envío
Etiquetas de categoría String, S2, Level 3

Etiquetas

Inicia sesión

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