Get the start and end of a char

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)
	{
		return true;
	}

	if (s[l] != s[r])
	{
		return false;
	}

	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?
From main, you usually call
isPalindrome(0,strlen(s)-1,s);
Thank you.
Have a nice day!
Topic archived. No new replies allowed.