Posts

Showing posts with the label palindrome or not

Q. write a program to accept a string and find out whether it is palindrome or not using pointer. ( C programming )

Image
Palindrome using pointer: Solution: #include < stdio.h > #include < conio.h > #include < string.h > void main() {     int c=0,d;     char str[30];char *a,*b;     clrscr();     printf (" Enter the string: ");        scanf("%s",str);     a=str;     for (a=str; *a!='\0';a++);     --a;       printf (" a points last character now: %c",*a);     for (b=str; *b==*a; b++)     {        c=c+1;        --a;     }     printf ("c:%d",c);     d=strlen(str);     if (c==d)              printf ("\n Given String is Palindrome ");     else           ...