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 do you initialize pointer variables?
What is array of structure in c programming?
How can variables be characterized?
what value is returned to operating system after program execution?
How many keywords are there in c?
What is the difference between ++a and a++?
Draw a diagram showing how the operating system relates to users, application programs, and the computer hardware ?
Explain how can I avoid the abort, retry, fail messages?
When should we use pointers in a c program?
What is the significance of c program algorithms?
Write a program to swap two numbers without using third variable in c?
What are the types of pointers in c?
Difference between Shallow copy and Deep copy?
Write an efficient algo and C code to shuffle a pack of cards.. this one was a feedback process until we came up with one with no extra storage.
What is the size of structure pointer in c?