For some reason my palindrome function is not working, I'd love some help on it:
Code
int Pal(char *s, int a, int b)
{
if (a>= b)
return 1;
if (s[a] != s[b])
return 0;
return Pal(s, ++a , --b);
}
int main()
{
char *s = "civic";
if (Pal(s , 1, strlen(s)))
printf("YES\n");
else
printf("No\n");
}
It keeps printing No, and I'm clueless to why this is happening.