taking 2 strings with %s and %c and comparing them using if else

 #include<stdio.h>

int main()
{
 char s1[100];
    char s2[100];
    gets(s1);
    puts(s1);
    printf("enter s2:");
    char c;
    int i;
    for ( i=0;c!='\n';i++)
    {
scanf("%c",&c);
s2[i]=c;
    }  
    s2[i]='\0';


puts(s2);
if(s1==s2)
{
    printf("both strings are same");
}
else{
    printf("strings arre not same" );
}
}

Comments