The character data type is one of the primitive data types by C++ programming language. The character data type uses keyword and it has a minimum size of or .
This is good enough to hold any characters because the values of characters in keyboard lies between . In other words, there are total characters in character set.
Learn C++ programming basics before you begin with character data types.
There are many types of character data types in C++. See the list below.
- unsigned char
- signed char
The most common form usage is char and its size of 1-byte good enough to hold any machine’s basic character set. The char is the keyword.
The plain char is unsigned in most machines and its size if 8-bits. But, the values it can take ranges from to .
The signed char is also of 8-bits and it takes positive as well as negative values. The range is from to . In some machines, it is to .
This character data type can hold any character set which include not only the basic character set, but any extended character set of a system. The extended characters are wider than bits and starts with .
For example, .
char16_t and char32_t
The char16_t and char32_t is to represent the UTF-8-character sets which is any natural language.