|
||
int strncmp( char *s1, char *s2, size_t count )
char *s1; /* a string */ char *s2; /* a string */ size_t count; /* maximum number of characters to copare */
|
|
|
Synopsis |
#include "string.h"
The strncmp function compares up to count characters starting at s1 with the string at s2 . If a null-terminator is encountered before count characters are compared, then the comparison stops.
|
|
Parameters |
s1 and s2 are null-terminated strings. count is an integer specifying the maximum number of characters to compare.
|
|
Return Value |
strncmp returns 0 if the strings are lexographically equal through their first count characters. Otherwise, if the string at s1 is lexicographically less than s2 , then strncmp returns a negative number; if the string at s1 is lexicographically greater than s2 , then strncmp returns a positive number.
|
|
See Also |
|
|
|
|