C Programming/C Reference/wchar.h/wcsncmp
In C language ,the function wcscmp is included in header file , wchar.h. The functions wcsncmp ,wcscmp , strncmp , strcmp are used to compare strings. Function wcsncmp, is similar to strncmp() , which is used to compare two fixed-size wide-character strings. it looks similar to strncmp() .This function is used to handle wide character strings. The wcsncmp() function is the wide-character equivalent of the strncmp() function. The function wcsncmp is similar to wcscmp ,but it compares only first n characters.
Wcsncmp is the standard library function used to compare two wide character strings. The function is similar to standard library function strcmp. But the comparison is not like strcmp. The first difference is that the function wcsncmp compares the two strings upto some limit(at most n character) i.e size_t n but strcmp compares the strings till '\0' occures. and the second is that it handles wide characters as mentioned. It compares the wide-character string pointed to by say a and the wide character string pointed to by say b, but at most n wide characters from each string.
If the wide character string a is greater than wide character string b at first diffrentiating position i (i < n) then the function Wcsncmp returns positive integer and if second string is greater than first at the first differing position i (i < n), then the function wcsncmp returns negative integer. if the first i characters (i < n) of a and b are equal , the function wcsncmp returns 0.
Syntax↑Jump back a section
|Function||What it does||Arguments|
|Wcsncmp||Compare first n characters of two wide character strings||const wchar_t *a, const wchar_t *b , size_t n|
|Wcscmp||Compare two wide character strings until '\0' occurs of one of the string||const wchar_t *a , const wchar_t *b|
|Strncmp||Compare first n characters of two (normal) character strings||const char *a , const char *b , size_t n|
|Strcmp||Compare character strings until '\0' occurs of one of the string||const char *a , const char *b|