Write a program to check whether the string is palindrome or not using pointers in c Language

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);
}

kabeer

Added  Jul 24, 11:51 am

Article tags

×
Google login
SignUp with Email
X