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

Why does notstrcat(string, "!");Work?

764


What is pointer to pointer in c with example?

640


How can I change their mode to binary?

789


What is the difference between far and near in c?

692


What is sizeof in c?

664






What is the use of structure padding in c?

676


Is struct oop?

665


What is volatile keyword in c?

668


What is void pointers in c?

678


Is a pointer a kind of array?

678


What is a sequential access file?

740


In cryptography, you could often break the algorithm if you know what was the original (plain) text that was encoded into the current ciphertext. This is called the plain text attack. In this simple problem, we illustrate the plain text attack on a simple substitution cipher encryption, where you know each letter has been substituted with a different letter from the alphabet but you don’t know what that letter is. You are given the cipherText as the input string to the function getwordSets(). You know that a plain text "AMMUNITION" occurs somewhere in this cipher text. Now, you have to find out which sets of characters corresponds to the encrypted form of the "AMMUNITION". You can assume that the encryption follows simple substitution only. [Hint: You could use the pattern in the "AMMUNITION" like MM occurring twice together to identify this]

2065


In C language, the variables NAME, name, and Name are all the same. TRUE or FALSE?

852


What is typedf?

752


1.int a=10; 2.int b=20; 3. //write here 4.b=30; Write code at line 3 so that when the value of b is changed variable a should automatically change with same value as b. 5.

1778