Question: ```
#include<stdio.h>

int main(void)
{

    char name[40];      
    scanf("%s",name);

   if(name == "yes")    
   {
       printf("%s",name);
   }

   return 0
}

```

Answer: 
You need to use `strcmp` for string comparison.

Replace 

```
if(name == "yes")

```

With

```
if(strcmp(name,"yes") == 0)

```

---

`strcmp` returns

1. > 
> 0 if both strings are identical (equal) 
> 
> 
>
2. > 
> Negative value if the ASCII value of first unmatched character is less than second.
> 
> 
>
3. > 
> Positive value if the
>  ASCII value of first unmatched character is greater than second.
> 
> 
>
`==` isn't defined for string (or any other array) comparisons - you need to use the standard library function `strcmp` to compare strings:

```
if ( strcmp( name, "yes" ) == 0 )

```

or

```
if ( !strcmp( name, "yes") )

```

`strcmp` is a little non-intuitive in that it returns 0 if the string contents are equal, so the sense of the test will feel wrong. It will return a negative value if the first string is lexicographically less than the second, and a positive value if the first string is lexicographically greater than the second.

You'll need to `#include <string.h>` in order to use `strcmp`. 

For comparing arrays that aren't strings, use `memcmp`.