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
How can I determine whether a machines byte order is big-endian or little-endian?
Explain can you assign a different address to an array tag?
What is the value of h?
int i[2], j; int *pi;i[0] = 1; i[1] = 5; pi = i; j = *pi + 1 + *(pi + 1)Value of j after execution of the above statements will be a) 7 b) 6 c) 4 d) pointer
What is the size of a union variable?
What is function and its example?
Where are local variables stored in c?
Can you please explain the scope of static variables?
Why can’t we compare structures?
Define VARIABLE?
What are the two types of functions in c?
What is #include stdio h and #include conio h?
explain what is a newline escape sequence?
Why we use int main and void main?
Write a program that accept anumber in words