C++ Character Data Types

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 .

Advertisements

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.

  1. char
  2. unsigned char
  3. signed char
  4. wchar_t
  5. char16_t
  6. char32_t

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.

unsigned char

The plain char is unsigned in most machines and its size if 8-bits. But, the values it can take ranges from to .

Advertisements

signed char

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 .

wchar_t

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.

Advertisements

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Exit mobile version