Scroll Down to See All
abortabsacosasctimeasctime_rasinassertatanatan2atexitatofatoiatolbsearchbtowccalloccatclosecatgetscatopenceilclearerrclockcoscoshctimectime_rdifftimediverferfcexitexpfabsfclosefdopenfeofferrorfflushfgetcfgetposfgetsfgetwcfgetwsfopenfprintffputcfputwsfreadfreefreopenfrexpfscanffseekfsetposftellfwidefwprintffwritefwscanfgetcgetchargetenvgetwcgetwchargmtimegmtime_rhypotisalnumisalphaisasciiisblankiscntrlisdigitisgraphislowerisprintispunctisspaceisupperiswalnumiswalphaiswblankiswcntrliswctypeiswdigitiswgraphiswloweriswprintiswpunctiswspaceiswupperiswxdigitisxdigitj0j1jnlabsldexpldivlocaleconvlocaltimelocaltime_rloglog10longjmpmallocmbrlenmbrtowcmbsinitmbsrtowcsmbstowcsmbtowcmemchrmemcmpmemcpymemmovememsetmktimemodfnextafternextafterlnexttowardnexttowardlnl_langinfoperrorpowprintfputcputcharputenvputsputwcputwcharqsortquantexpd32quantexpd64quantexpd128quantized32quantized64quantized128samequantumd32raiserandrand_rreallocregcompregerrorregexecregfreeremoverenamerewindscanfsetbufsetjmpsetlocalesetvbufsignalsinsinhsnprintfsprintfsqrtsrandsscanfstrcasecmpstrcatstrchrstrcmpstrcollstrcpystrcspnstrerrorstrfmonstrftimestrlenstrncasecmpstrncatstrncmpstrncpystrpbrkstrptimestrrchrstrspnstrstrstrtodstrtod32strtod64strtod128strtofstrtokstrtok_rstrtolstrtoldstrtoulstrxfrmswprintfswscanfsystemtantanhtimetime64tmpfiletmpnamtoasciitolowertouppertowctranstowlowertowupperungetcungetwcva_argva_copyva_endva_startvfprintfvfscanfvfwprintfvfwscanfvprintfvscanfvsprintfvsnprintfvsscanfvswprintfvswscanfvwprintfvwscanfwcrtombwcscatwcschrwcscmpwcscollwcscpywcscpywcsftimewcslenwcsncatwcsncmpwcsncpywcspbrkwcsptimewcsrchrwcsrtombswcsspnwcsstrwcstodwcstod32wcstod64wcstod128wcstofwcstokwcstolwcstoldwcstombswcstoulwcsxfrmwctobwctombwctranswctypewcwidthwmemchrwmemcmpwmemcpywmemmovewmemsetwprintfwscanfy0y1yn



Function Details : mblen

intmblen(const char * s,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 mblen function .

1st Parameter Type : const char *

Pointer to read-only string

1st Parameter

A pointer to the multibyte character to be analyzed. If `s` is `NULL`, the function resets the conversion state.

2nd Parameter Type : size_t

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

2nd Parameter

The maximum number of bytes to examine in the multibyte character sequence.

Read more about parameters of mblen in parameters section
The mblenfunction in C language Returns the number of bytes in the next multibyte character.
The mblen function determines the number of bytes contained in the multibyte character pointed to by s, examining at most n bytes. If s is a null pointer, the mblen function resets the shift state to the initial shift state. The behavior of this function is affected by the LC_CTYPE category of the current locale.
The mblenfunction takes 2 parameters:
  • const char * `s`: A pointer to the multibyte character to be analyzed. If `s` is `NULL`, the function resets the conversion state.
  • size_t `n`: The maximum number of bytes to examine in the multibyte character sequence.
Determines the number of bytes in the multibyte character pointed to by `s`, considering at most `n` bytes. Returns the length of the multibyte character in bytes, 0 if `s` points to the null character, or -1 if the multibyte sequence is invalid. If `s` is `NULL`, the function resets the internal conversion state and returns 0 if multibyte characters are state-independent.
The mblen function return value :
  • If s is not a null pointer, the mblen function returns: 0 if s points to a null byte, the number of bytes that constitute the next multibyte character, or -1 if the next n bytes do not form a valid multibyte character
  • If s is a null pointer, the mblen function returns a nonzero value if multibyte character encodings have state-dependent encodings, and zero otherwise

Output

This example demonstrates basic usage of mblen to determine the length of each multibyte character in a string.