Icons
Questions
Snippets
Program to check whether the string is palindrome or not using pointers
# include<stdio.h>
main()
{
char a[20], *front, *back;
printf("\nEnter string : ");
gets(a);
fflush(stdin);
for(back=a; *back!=0; back++);
back--;
for(front=a; front<=back; back--, front++)
{
if(*front != *back)
break;
}
if(front > back)
printf("%s is a palindrome", a);
else
printf("%s is not a palindrome",a);
}