I have a prototype restriction of bool pal(char str[], int length)
and I need to test whether a string the user entered is a palindrome or not. The code I have is:
bool pal(char str[], int length)
{
if(*str == str[length - 1])
{
pal(str+1, length-1);
}
else
{
return false
}
return true;
}
but it seems to only be testing if the first character is the same as the last character. I think this is because my array (start point) isn't incrementing but I'm not sure why.