Palindrome using pointer:
Solution:#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;
for(b=str; *b==*a; b++)
{
c=c+1;
--a;
}
d=strlen(str);
if(c==d)
printf("\nGiven String is Palindrome");
else
printf("\nGiven string is not palindrome");
}
" Hi I am a Learner of C/C++. I have done this program with my own Knowledge. There may be easy way to solve this programs. So I am sorry if this program in your point of view is too long. "
No comments:
Post a Comment
Hello Friends...! Lets share Your Views,Ideas,Comments here....!!