Find string palindrome 10marks

Answer Posted / abdur rab

#include <stdio.h>

int isPalindrome ( char* str, int nLength )
{
if ( nLength < 1 ) return ( 1 );
if ( str [0] == str [ nLength -1 ] ) return (
isPalindrome ( ( str + 1 ) , ( nLength - 2 ) ) );
else return ( 0 );
}

int main (int argc, char* argv[])
{
char a[10] = {"ropepor"};
if ( isPalindrome ( a, strlen ( a ) ) ) printf
("\n The string is Palindrome");
else printf ("\n The string is NOT Palindrome");
return (1 );

Is This Answer Correct ?    7 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Subtract Two Number Without Using Subtraction Operator

352


Explain what is the difference between functions getch() and getche()?

604


Explain what are reserved words?

632


Are comments included during the compilation stage and placed in the EXE file as well?

669


write a program which the o/p should b in such a way that s triangle if I/p is 3,a Square/rectangle if I/P=4,a pentagon if I/P=5 and so on...forget about the I/P which is less than 3

1642






Which is more efficient, a switch statement or an if else chain?

578


Is c easier than java?

567


what are enumerations in C

721


What are multibyte characters?

642


What is the data segment that is followed by c?

606


When is a void pointer used?

673


What is meant by type specifiers?

659


Why is python slower than c?

600


How can you increase the allowable number of simultaneously open files?

593


write a C program:There is a mobile keypad with numbers 0-9 and alphabets on it. Take input 0f 7 keys and then form a word from the alphabets present on the keys.

14958