Ask your own question, for FREE!
Computer Science 7 Online
OpenStudy (anonymous):

c program to check whether a string is palindrome or not with user defined functions. does anyone know pls i have test tomorrow

OpenStudy (rsmith6559):

Palindromes can be checked recursively. Your base case would be the length of the char array is less than 2 ( 0 or 1 characters left ). If the first and last character of the array are equal, just call the function again with the char array[ 1, -1 ]. If they don't match, return false immediately. When you get to the base case, they all have matched so it is a palindrome so you return true.

OpenStudy (anonymous):

I would point indices at the first `0` and last `n-1` positions (where `n=len( string )`). I would move them both closer to the center while checking whether of not the characters are equal (not a palindrome if unequal) and if the indices have passed each other (a palindrome if passed).

OpenStudy (anonymous):

I mean to say `n = strlen( string )`.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
Arriyanalol: i need help
10 hours ago 7 Replies 1 Medal
Arriyanalol: CONGRATS to me
13 hours ago 8 Replies 2 Medals
Legomaster346: What colleges are good that are near Arab Alabama?
1 week ago 5 Replies 0 Medals
Arriyanalol: i need help
1 week ago 6 Replies 2 Medals
Arizona: does anyone know the percentage rate of 30,000 and 40,000
1 week ago 0 Replies 0 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!