This is an another Program to show check Palindrome , But this check Palindrome of a string instead of a number..
A string is any array of Characters. For example word "Arora " is a palindrome…..
/*"Author: Mitochondria Technologies Inc. "*/
/* Program to test whether given string is a palindrome */
#include<stdio.h>
#include<conio.h>
#include<string.h>
enum boolean{false,true};
enum boolean string_palindrome(char string[]);
void main()
{
char string [40];
clrscr();
printf("enter a string:");
scanf("%s",&string);
if (string_palindrome(string))
printf("string is a palindrome\n");
else
printf("string is not a palindrome\n");
getch();
}
enum boolean string_palindrome(char string[])
{
int left,right,len=strlen(string);
enum boolean matched=true;
if(len==0)
return true;
left=0;
right=len-1;
while(left<right && matched)
{
if (string[left]!=string[right])
matched=false;
else
{
left++;
right--;
}
}
return matched;
}