Everything

strncmp


Compares two strings specified up to a specified length.

[Format]

#include <string.h>

long strncmp (const char *s1, const char *s2, size_t n);

[Parameters]

s1 Pointer to the reference string to be compared

s2 Pointer to the string to compare to the reference

n Maximum number of characters to compare

[Return values]

If string pointed by s1 > string pointed by s2: Positive value

If string pointed by s1 == string pointed by s2: 0

If string pointed by s1 < string pointed by s2: Negative value

[Remarks]

The strncmp function compares the contents of the strings pointed by s1 and s2, up to n characters. The rules of comparison are implementation-defined.