Given a string , check whether the reverse read of the string is same and print as "palindrome" if it does else print "not a palindrome" using two pointers with one pointer pointing to the starting index of the string and other pointer pointing to the ending index of the string.
#include <stdio.h> int main(void) { char *s,*e; int flag=1; s=(char*)malloc(sizeof(char)); scanf("%s",s); e=(s+strlen(s)-1); while(s!=e && (abs(s-e))!=1) { if(!(*s==*e)) { flag=0; break; } s++; e--; } if(flag) printf("palindrome"); else printf("not palindrome"); return 0; }