I actually created the code for palindrome of string using reverse and copy of strings without library function.But still it shows always it is palindrome.What mistake I have done.And it always prints it is always a palindrome regardless whether I give palindrome or not.I checked internet for code but want to know what mistake I made in my code so please help.
#include <stdio.h>
#include <string.h>
int main()
{
    char s[1000];
    char t[1000],temp;
    int i,j,flag=0;
    gets(s);
    for(i=0;i<strlen(s);i++)
    {
        t[i]=s[i];
    }
    printf("%s",t);
    int n=strlen(s)-1;
    for(j=0,i=n;i>=0;j++,i--)
    {
        t[j]=s[i];
    }
    printf("%s",t);
    for(i=0,j=0;i<=n,j<=n;i++,j++)
    {
        //for(j=0;j<n;j++){
        if(t[j]==t[i])
        {
            flag=1;
            break;
        }
    }
    if(flag==1)
    {
        printf(" palindrome");
    }
    else
    {
        printf("else Palindrome");
    }
    return 0;
}
 
     
     
     
    