Hi, I have a boolean function that recursively determines if something is a pali(assuming there are no spaces, special chars, etc), but I have a warning saying control reaches end of non-void function, but I can't seem to remove the error.
Can someone take a look?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
bool ispalindrome(string s){
if (s.length() <= 1){
returntrue;
}
if (s[0] == s[s.length()-1]){
return ispalindrome(s.substr(1, s.length()-2));
returnfalse;
}
}
(this is practice for a final exam. You won't be helping me cheat.)