I have a peice of code like this, to see whether a string entered is palindrome
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
bool isPalindrome(int l, int r, char* s)
{
if (l == r)
{
returntrue;
}
if (s[l] != s[r])
{
returnfalse;
}
if (l < r + 1)
{
return isPalindrome(l + 1, r - 1, s);
}
}
The problem is: to call this function in main(), I don't now how to get the right and the left of the char, as the function's parameters are int l and int r.
How to get the left and the right of the char in integer?