Scroll Down to See All
abortabsacosasctimeasctime_rasinassertatanatan2atexitatofatoiatolbsearchbtowccalloccatclosecatgetscatopenceilclearerrclockcoscoshctimectime_rdifftimediverferfcexitexpfabsfclosefdopenfeofferrorfflushfgetcfgetposfgetsfgetwcfgetwsfopenfprintffputcfputwsfreadfreefreopenfrexpfscanffseekfsetposftellfwidefwprintffwritefwscanfgetcgetchargetenvgetwcgetwchargmtimegmtime_rhypotisalnumisalphaisasciiisblankiscntrlisdigitisgraphislowerisprintispunctisspaceisupperiswalnumiswalphaiswblankiswcntrliswctypeiswdigitiswgraphiswloweriswprintiswpunctiswspaceiswupperiswxdigitisxdigitj0j1jnlabsldexpldivlocaleconvlocaltimelocaltime_rloglog10longjmpmallocmblenmbrlenmbrtowcmbsinitmbsrtowcsmbstowcsmbtowcmemchrmemcmpmemcpymemmovememsetmktimemodfnextafternextafterlnexttowardnexttowardlnl_langinfoperrorpowprintfputcputcharputenvputsputwcputwcharqsortquantexpd32quantexpd64quantexpd128quantized32quantized64quantized128samequantumd32raiserandrand_rreallocregcompregerrorregexecregfreeremoverenamerewindscanfsetbufsetjmpsetlocalesetvbufsignalsinsinhsnprintfsprintfsqrtsrandsscanfstrcasecmpstrcatstrchrstrcmpstrcollstrcpystrcspnstrerrorstrfmonstrftimestrlenstrncasecmpstrncatstrncmpstrncpystrpbrkstrptimestrrchrstrspnstrstrstrtodstrtod32strtod64strtod128strtofstrtokstrtok_rstrtolstrtoldstrtoulstrxfrmswprintfswscanfsystemtantanhtimetime64tmpfiletmpnamtoasciitolowertouppertowctranstowlowertowupperungetcungetwcva_argva_copyva_endva_startvfprintfvfscanfvfwprintfvfwscanfvprintfvscanfvsprintfvsnprintfvsscanfvswprintfvswscanfvwprintfvwscanfwcrtombwcscatwcschrwcscmpwcscollwcscpywcscpywcsftimewcslenwcsncatwcsncpywcspbrkwcsptimewcsrchrwcsrtombswcsspnwcsstrwcstodwcstod32wcstod64wcstod128wcstofwcstokwcstolwcstoldwcstombswcstoulwcsxfrmwctobwctombwctranswctypewcwidthwmemchrwmemcmpwmemcpywmemmovewmemsetwprintfwscanfy0y1yn



Function Details : wcsncmp

intwcsncmp(const wchar_t * ws1,const wchar_t * ws2,size_t n) ;

Return Type : int

Integer type (typically 4 bytes, -2,147,483,648 to 2,147,483,647)
Read about return values of wcsncmp function .

1st Parameter Type : const wchar_t *

A pointer to a read-only wide-character string, where each character is of type `wchar_t`. Used for representing text in wide-character encoding to support extended character sets, such as Unicode. The string is null-terminated, with the terminator being a `wchar_t` with value 0.

1st Parameter

Pointer to the first null-terminated wide-character string to be compared.

2nd Parameter Type : const wchar_t *

A pointer to a read-only wide-character string, where each character is of type `wchar_t`. Used for representing text in wide-character encoding to support extended character sets, such as Unicode. The string is null-terminated, with the terminator being a `wchar_t` with value 0.

2nd Parameter

Pointer to the second null-terminated wide-character string to be compared.

3rd Parameter Type : size_t

Platform-specific unsigned type for array indices and memory sizes.

3rd Parameter

The maximum number of wide characters to compare.

Read more about parameters of wcsncmp in parameters section
The wcsncmpfunction in C language Compares a specified number of characters from two wide character strings.
wcsncmp compares up to n wide characters from the wide string pointed to by s1 to the wide string pointed to by s2. The comparison is done lexicographically. If the strings are equal, the function returns 0. If they differ, it returns a value greater than or less than 0 depending on whether the first differing wide character in s1 is greater or less than the corresponding character in s2.
The wcsncmpfunction takes 3 parameters:
  • const wchar_t * `ws1`: Pointer to the first null-terminated wide-character string to be compared.
  • const wchar_t * `ws2`: Pointer to the second null-terminated wide-character string to be compared.
  • size_t `n`: The maximum number of wide characters to compare.
Compares up to `n` wide characters of the wide-character strings `ws1` and `ws2` lexicographically. Returns an integer less than, equal to, or greater than zero if `ws1` is found to be less than, equal to, or greater than `ws2`, respectively. The comparison stops when a null character is encountered, `n` characters have been compared, or a difference is found.
The wcsncmp function return value :
  • Returns an integer less than, equal to, or greater than zero if s1 (or the first n wide characters thereof) is found, respectively, to be less than, to match, or be greater than s2

Output

This example demonstrates the basic usage of wcsncmp to compare the first 7 characters of two wide strings.