Syntax:
#include <cstring> int strncmp( const char *str1, const char *str2, size_t count );
The strncmp() function compares at most count characters of str1 and str2. The return value is as follows:
| Return value | Explanation | 
|---|---|
| less than 0 | str1is less thanstr2 | 
| equal to 0 | str1is equal tostr2 | 
| greater than 0 | str1is greater thanstr2 | 
If there are less than count characters in either string, then the comparison will stop after the first null termination is encountered.
Related Topics: strchr, strcmp, strcpy, strlen, strncat, strncpy