How to check whether string is a palindrome, WITHOUT USING
STRING FUNCTIONS?
Answer Posted / narasimharao
#include<stdio.h>
#include<conio.h>
void main()
{
char str[20]="malayalam",str1[20];
int i,j,k,c;
clrscr();
for(c=0;str[c]!='\0';c++)
{
}
printf("%d\n",c);
for(i=c-1,j=0;i>=0;i--,j++)
{
str1[j]=str[i];
}
printf("%s\n",str1);
k=1;
for(i=0;str[i]!='\0';i++)
{
if(str[i]!=str1[i])
{
k=0;
break;
}
}
if(k==1)
printf("Given String is Palindrome");
else
printf("Given String is Not Palindrome");
getch();
}
| Is This Answer Correct ? | 10 Yes | 8 No |
Post New Answer View All Answers
What does %c mean in c?
Can a variable be both constant and volatile?
Are negative numbers true in c?
What is a struct c#?
Write a program to check armstrong number in c?
What is meant by 'bit masking'?
If jack lies on Mon, Tue Wed and jill lies on Thursday, Friday and Saturday. If both together tell they lied yesterday. So c the given options and then c cos in the given dates one will be saying the truth and one will be lying. I got Thursday as option because jack is saying the truth he lied yest but jill is lying again as he lies on that day.
What is sizeof return in c?
Why is c fast?
What is self-referential structure in c programming?
What is clrscr in c?
When should structures be passed by values or by references?
Can true be a variable name in c?
in iso what are the common technological language?
write a program to print data of 5 five students with structures?