#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");
    }
}
Member Avatar

I_m_rude

what now ?

Member Avatar

I_m_rude

it is sizeof() operator, not sizof. spelling error. check it now.

but my target is without using any string functions myfriend

try 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 index from the start of the word and j from the end and n as the counter to check if the word is a palindrome
       j = strlen(string) - 1;
       for(i = 0; i <= j ; i++,j--){                   
           if(string[i]!=string[j]){                
               n=1; //counter tells that the sting is currently not a palindrome                                 
               break;  //once found that character doesn't matches it breaks from the loop                             
           }
           if(string[i]==string[j]){                
               n=0; //counter tells that the sting is currently a palindrome                                
           } 
       } 

then print the word is not a palindrome if the value of n is 1 else a palindrome

ooh i didnt think at all any way thanks zeroliken