Next Previous Contents

74. strncmp

Synopsis

Compare the first few characters of two strings

Usage

Integer_Type strncmp (String_Type a, String_Type b, Integer_Type n)

Description

This function behaves like strcmp except that it compares only the first n characters in the strings a and b. See the documentation for strcmp for information about the return value.

Example

The expression

     strcmp ("apple", "appliance", 3);
will return zero since the first three characters match.
See Also

strcmp, strlen


Next Previous Contents