Friday, July 29, 2016

C Basics - Extended Characters in C

C support extended character sets: multibyte characters and wide characters.

A multibyte character is a character composed of sequences of one or more bytes. Each byte sequence represents a single character in the extended character set. Multibyte characters are used in Asian language character sets.

Wide characters are multilingual character codes that are always 16 bits wide. The type is wchar_t. Wide characters are much simpler than multibyte characters.

The built-in functions for translating between multibyte and wide characters are,

The mbstowcs function converts a string of multibyte characters to a wide character array. The wcstombs function does the reverse.

The mblen returns the number of bytes that make up the multibyte character.

The mbtowc function converts the first multibyte character beginning at string to its corresponding wide character code. The wctomb function does the reverse.



Related topics:
Tokens in C   |   Character Set in C   |   White Space Characters in C   |   Trigraph Characters in C   |   Escape Sequence in C   |   Comments in C   |   Keywords in C   |   Identifiers in C   |   Declaration in C

List of topics: C Programming

No comments:

Post a Comment