C Palindrome String using Pointers Example, C Program to find String Palindrome or not.

C Program for Palindrome String using Pointers Example, C Program to find String Palindrome or not?

Example : Write a Program to print a String Palindrome or not in C Language is given below:-

#include<stdio.h>
#include<conio.h>
#include<string.h>

int string_Palindrome(char* str)
{
int i,len;
len = strlen(str);
for( i = 0 ; i < len / 2 ; i++ )
{
if( *(str + i ) != *(str + len - i - 1) )
return 0;
}
return 1;
}
void main()
{
char string[100]="";
clrscr();
printf("Enter a string :");
gets(string);
if( string_Palindrome(string))
printf("\n%s is a palindrome",string);
else
printf("\n%s is not a palindrome",string);
getch();
}