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
How can I change the size of the dynamically allocated array?
Which is not valid in C a) class aClass{public:int x;}; b) /* A comment */ c) char x=12;
What is sizeof return in c?
What is cohesion in c?
What is difference between arrays and pointers?
What is table lookup in c?
How can I read/write structures from/to data files?
In c language can we compile a program without main() function?
What is a struct c#?
How can you find the day of the week given the date?
State the difference between realloc and free.
Can one function call another?
Is printf a keyword?
What is mean by Data Driven framework in QTP? Can any one answer me in details on this regard.
What is the difference between ++a and a++?