#include <stdio.h>
#include <stdlib.h>
void main()
{
char x[10],y[10];
int i,j,k,flag=0;
printf("enter the string: ");
fgets(x,sizof(x),stdin);
for(i=0;x[i]!='\0';i++)
for(j=0,k=i;x[k]!='\0';j++,k--)
{
y[j]=x[k];
}
if(x==y)
{
printf("the string is palindrome");
}
else
{
printf("not palindrome");
}
}
rithish 13
Junior Poster in Training
Recommended Answers
Jump to PostThis could easily be solved with the strrev function from the string library
here's a link with the answer
Jump to Posttry to check the beginning and end of the indeces of the string if equal. The index starting from the beginning to increment and the index starting at the end to decrement and comparing both of them
e.g.//here int i is the counter of the …
All 7 Replies
I_m_rude
rithish 13
Junior Poster in Training
I_m_rude
zeroliken 79
Nearly a Posting Virtuoso
rithish 13
Junior Poster in Training
zeroliken 79
Nearly a Posting Virtuoso
rithish 13
Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.