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

Want to know how to write a C program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.

1513


What is the difference between near, far and huge pointers?

622


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

587


Can include files be nested? How many levels deep can include files be nested?

649


What are structural members?

560






What is c language in simple words?

583


What is the meaning of 2d in c?

600


Why is structure important for a child?

597


What is structure pointer in c?

565


Which built-in library function can be used to match a patter from the string?

731


Tell me what is null pointer in c?

601


What is nested structure?

566


This is a variation of the call_me function in the previous question:call_me (myvar)int *myvar;{ *myvar += 5; }The correct way to call this function from main() will be a) call_me(myvar) b) call_me(*myvar) c) call_me(&myvar) d) expanded memory

717


What is malloc() function?

628


How to explain the final year project as a fresher please answer with sample project

459