Embedded Artistry Framework
Embedded Systems C++ Framework
Functions
strncmp.c File Reference
#include <string.h>
Include dependency graph for strncmp.c:

Functions

int strncmp (const char *s1, const char *s2, size_t n)
 Compares at most n characters of two possibly null-terminated arrays. More...
 

Function Documentation

◆ strncmp()

int strncmp ( const char *  s1,
const char *  s2,
size_t  n 
)

Compares at most n characters of two possibly null-terminated arrays.

Compares at most count characters of two possibly null-terminated arrays. The comparison is done lexicographically.

The behavior is undefined when access occurs past the end of either array s1 or s2. The behavior is undefined when either s1 or s2 is the null pointer.

Parameters
s1pointers to the null-terminated byte strings to compare
s2pointers to the null-terminated byte strings to compare
nmaximum number of characters to compare
Returns
Negative value if s1 appears before s2 in lexicographical order. Zero if s1 and s2 compare equal, or if n is zero. Positive value if s1 appears after s2 in lexicographical order.

References n, NULL, r, s1, and s2.

Referenced by strdup_test(), strncmp_test(), strndup_test(), and strnstr().

Here is the caller graph for this function: