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
What is the use of function overloading in C?
What is a spanning Tree?
What do you mean by c what are the main characteristics of c language?
process by which one bit patten in to another by bit wise operation is? (a) masking, (b) pruning, (c) biting, (d) chopping,
Write a program to print all permutations of a given string.
When the macros gets expanded?
Explain main function in c?
What is calloc()?
provide an example of the Group by clause, when would you use this clause
Write a C/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 maximum number of concurrent threads that the InnoDB plug-in can create.
What are the 5 types of organizational structures?
What is pointers in c?
Which header file is essential for using strcmp function?
Why is a semicolon (;) put at the end of every program statement?
Do character constants represent numerical values?