3.4. strcmp

int strcmp( const char *s1, const char *s2);
strcmp compares string s1 to s2 and returns <0 if s1<s2, 0 if s1==s2, or >0 if s1>s2.

Note: the characters are compared, not the pointers.

For example, to search stdin for lines containing only "beef stew\n":

        while( fgets( line, BUFSIZ, stdin) != NULL)     /* read one line */
            if( strcmp( line, "beef stew\n") == 0)      /* check for match */
                fputs( line, stdout);