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
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.
What is the difference between near, far and huge pointers?
How can you increase the allowable number of simultaneously open files?
Can include files be nested? How many levels deep can include files be nested?
What are structural members?
What is c language in simple words?
What is the meaning of 2d in c?
Why is structure important for a child?
What is structure pointer in c?
Which built-in library function can be used to match a patter from the string?
Tell me what is null pointer in c?
What is nested structure?
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
What is malloc() function?
How to explain the final year project as a fresher please answer with sample project