Standard C Functions


strncmp


Syntax

#include <string.h>
int strncmp(const char *str1, const char *str2, int n)

Arguments

str1      pointer to the first character string 
str2      pointer to the second character string 
n         number of characters to compare (the length of the string segment)

Return Value

A value less than 0
        str1 is lexicographically less than str2 
A value equal to 0
        str1 is equal to str2
A value greater than 0
        str1 is greater than str2

Description

It compares at most n characters lexicographically from str1 to at most n characters from str2.