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


Please Help Members By Posting Answers For Below Questions

How do you initialize pointer variables?

608


What is array of structure in c programming?

747


How can variables be characterized?

1645


what value is returned to operating system after program execution?

1599


How many keywords are there in c?

586






What is the difference between ++a and a++?

688


Draw a diagram showing how the operating system relates to users, application programs, and the computer hardware ?

2116


Explain how can I avoid the abort, retry, fail messages?

587


When should we use pointers in a c program?

626


What is the significance of c program algorithms?

676


Write a program to swap two numbers without using third variable in c?

613


What are the types of pointers in c?

526


Difference between Shallow copy and Deep copy?

1564


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.

655


What is the size of structure pointer in c?

610