#include<stdio.h>
int string_palindrome(char *s)
{
char *p;
p=s;
while(*p!='\0')
{
*p++;
}
p--;
while(*s!='\0')
{
if(*s!=*p)
{
return 1;
}
s++;
p--;
}
return 0;
}
main()
{ char a[100];
int l,flag;
printf("Enter a string\n");
gets(a);
flag=string_palindrome(a);
if(flag==0)
{
printf("String is palindrome");
} else
{ printf("String is not palindrome");
}
}
Note: Need to be arranged in compiler after copied
OutPut:
Enter a string
MadaM
String is palindrome