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
Is there a way to switch on strings?
How can I do serial ("comm") port I/O?
What are local static variables? How can you use them?
What is a struct c#?
What is substring in c?
What are disadvantages of C language.
Q.1 write a program to create binary tree 1 to 16 numbers? Q.2 write a program to creat a binary search tree for the member that is given by user?
any "C" function by default returns an a) int value b) float value c) char value d) a & b
An organised method of depicting the use of an area of computer memory used to signify the uses for different parts of the memory a) swap b) extended memory c) memory map d) all of the above
Can we declare variables anywhere in c?
Is c high or low level?
Difference between Shallow copy and Deep copy?
ATM machine and railway reservation class/object diagram
What is the advantage of an array over individual variables?
If you know then define #pragma?