c - Recursive method for palindrome checkup -
is possible define recursive method palindrome checkup following argument list?
int testpalindromerecursive(char* str, int len) { ... } note: no external sub-functions or global variables have used
i think impossible, because have remember last (front) index position somehow.
yes, possible - several people have mentioned.
base cases:
- if len <= 1, return true
- if str[0] != str[len-1] return false
else: recurse (str+1, len -2)
Comments
Post a Comment