Palindrome Using Pointers:

#include
#include
int main()
{
char str[30];
char *a,*b;
printf("Enter any string : ");
gets(str);
for(a=str ; *a!=NULL ;a++); //here a stores address for 'str' //
  for(b=str, a-- ; a>=b; ) // b stores address for str//
{
if(*a==*b) //if we put * sign over a and b then it means the value of str string variable//
 {
a--;
b++;
}
else
break;
}
if(b>a)
printf("\nString is palindrome");
else
printf("\nString is Not palindrome");
printf("\n\nProgramming at C#ODE STUDIO");
getch();
return 0;

}

OUTPUT-

POINTER

4 thoughts on “Palindrome Using Pointers:

    • Hello Muthu!
      The program is working just fine. It also has attached output screen capture. Please make sure that you don’t copy and paste it as it contains ASCII characters. It won’t help you. Thank you for visiting CODE Studio.

Leave a comment