Next Previous Contents

67. strcmp

Synopsis

Compare two strings

Usage

Interpret strcmp (String_Type a, String_Type b)

Description

The strcmp function may be used to perform a case-sensitive string comparison, in the lexicongraphic sense, on strings a and b. It returns 0 if the strings are identical, a negative integer if a is less than b, or a positive integer if a is greater than b.

Example

The strup function may be used to perform a case-insensitive string comparison:

    define case_insensitive_strcmp (a, b)
    {
      return strcmp (strup(a), strup(b));
    }
Notes

One may also use one of the binary comparison operators, e.g., a > b.

See Also

strup, strncmp


Next Previous Contents