Currently At: Programming Reference > C Reference > Standard C String & Character > strncmp()

strncmp()


Syntax:
#include <string.h>
int strncmp( const char *str1, const char *str2, size_t count );


Description:
The strncmp() function compares at most count characters of str1 and str2. The return value is as follows:

Return value Explanation
------------ -----------
less than 0 str1 is less than str2
equal to 0 str1 is equal to str2
greater than 0 str1 is greater than str2

If there are less than count characters in either string, then the comparison will stop after the first null termination is encountered.

Related Topics:
strcmp(), strnchr(), strncpy()


Web Standards & Support:

Link to and support eLook.org Powered by LoadedWeb Web Hosting
Valid XHTML 1.0! Valid CSS! eLook.org FireFox Extensions